应用程序在 [scrollView removeFromSuperview] 上崩溃;
哎呀,
我是 iPhone 新手,正在努力解决以下问题。
当我使用以下语句删除滚动视图时,我的应用程序崩溃了。
[scrollView removeFromSuperview];
我使用以下行添加 uiscrollview。
[self.view addSubview:scrollView];
这是日志。
Thread 0 Crashed:
0 libobjc.A.dylib 0x34a80466 objc_msgSend + 18
1 UIKit 0x341aaaa8 -[UIView(Hierarchy) _makeSubtreePerformSelector:withObject:withObject:copySublayers:] + 152
2 UIKit 0x341aaace -[UIView(Hierarchy) _makeSubtreePerformSelector:withObject:withObject:copySublayers:] + 190
3 UIKit 0x341aaace -[UIView(Hierarchy) _makeSubtreePerformSelector:withObject:withObject:copySublayers:] + 190
4 UIKit 0x341c05a0 -[UIView(Hierarchy) removeFromSuperview] + 208
5 UIKit 0x34249a76 -[UIScrollView removeFromSuperview] + 42
6 KabushikiShimbun 0x000387b6 -[PDFPageScrollViewController ReGenerateScrollViewAsperNewData] (PDFPageScrollViewController.m:1451)
7 KabushikiShimbun 0x00038aac -[PDFPageScrollViewController CheckPageUpdationWithDate:] (PDFPageScrollViewController.m:1441)
8 KabushikiShimbun 0x0003c472 -[PDFPageScrollViewController requestFinished:] (PDFPageScrollViewController.m:792)
9 CoreFoundation 0x35818bb8 -[NSObject(NSObject) performSelector:withObject:] + 16
10 KabushikiShimbun 0x0000e9ba -[ASIHTTPRequest reportFinished] (ASIHTTPRequest.m:1945)
11 CoreFoundation 0x35818bb8 -[NSObject(NSObject) performSelector:withObject:] + 16
12 Foundation 0x3118178e __NSThreadPerformPerform + 262
13 CoreFoundation 0x358307d6 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 6
14 CoreFoundation 0x358025b0 __CFRunLoopDoSources0 + 376
15 CoreFoundation 0x35801e54 __CFRunLoopRun + 224
16 CoreFoundation 0x35801c80 CFRunLoopRunSpecific + 224
17 CoreFoundation 0x35801b88 CFRunLoopRunInMode + 52
18 GraphicsServices 0x320c84a4 GSEventRunModal + 108
19 GraphicsServices 0x320c8550 GSEventRun + 56
20 UIKit 0x341dc322 -[UIApplication _run] + 406
21 UIKit 0x341d9e8c UIApplicationMain + 664
22 KabushikiShimbun 0x00002da6 main (main.m:14)
23 KabushikiShimbun 0x00002d70 start + 32
有什么想法吗?
谢谢。
Hell All,
I am new to iPhone and struggling with following problem.
When i remove scroll view with following statement my appli crashes.
[scrollView removeFromSuperview];
I am adding uiscrollview with following line.
[self.view addSubview:scrollView];
Hereis the log.
Thread 0 Crashed:
0 libobjc.A.dylib 0x34a80466 objc_msgSend + 18
1 UIKit 0x341aaaa8 -[UIView(Hierarchy) _makeSubtreePerformSelector:withObject:withObject:copySublayers:] + 152
2 UIKit 0x341aaace -[UIView(Hierarchy) _makeSubtreePerformSelector:withObject:withObject:copySublayers:] + 190
3 UIKit 0x341aaace -[UIView(Hierarchy) _makeSubtreePerformSelector:withObject:withObject:copySublayers:] + 190
4 UIKit 0x341c05a0 -[UIView(Hierarchy) removeFromSuperview] + 208
5 UIKit 0x34249a76 -[UIScrollView removeFromSuperview] + 42
6 KabushikiShimbun 0x000387b6 -[PDFPageScrollViewController ReGenerateScrollViewAsperNewData] (PDFPageScrollViewController.m:1451)
7 KabushikiShimbun 0x00038aac -[PDFPageScrollViewController CheckPageUpdationWithDate:] (PDFPageScrollViewController.m:1441)
8 KabushikiShimbun 0x0003c472 -[PDFPageScrollViewController requestFinished:] (PDFPageScrollViewController.m:792)
9 CoreFoundation 0x35818bb8 -[NSObject(NSObject) performSelector:withObject:] + 16
10 KabushikiShimbun 0x0000e9ba -[ASIHTTPRequest reportFinished] (ASIHTTPRequest.m:1945)
11 CoreFoundation 0x35818bb8 -[NSObject(NSObject) performSelector:withObject:] + 16
12 Foundation 0x3118178e __NSThreadPerformPerform + 262
13 CoreFoundation 0x358307d6 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 6
14 CoreFoundation 0x358025b0 __CFRunLoopDoSources0 + 376
15 CoreFoundation 0x35801e54 __CFRunLoopRun + 224
16 CoreFoundation 0x35801c80 CFRunLoopRunSpecific + 224
17 CoreFoundation 0x35801b88 CFRunLoopRunInMode + 52
18 GraphicsServices 0x320c84a4 GSEventRunModal + 108
19 GraphicsServices 0x320c8550 GSEventRun + 56
20 UIKit 0x341dc322 -[UIApplication _run] + 406
21 UIKit 0x341d9e8c UIApplicationMain + 664
22 KabushikiShimbun 0x00002da6 main (main.m:14)
23 KabushikiShimbun 0x00002d70 start + 32
Any Idea ?
Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
从superview中移除之前检查它是否有superview;
Check whether it has a superview before removing from superview;
试试这个代码
Try this code
试试这个代码。已经测试过了。
但要小心,它会删除
self.view
中存在的所有ScrollViews
Try this code. It's tested.
but be carefull it removes all
ScrollViews
present in yourself.view