iphone - viewWillAppear 时 ECSlidingViewController 错误(对象不能为 nil)
<p><p>在我的应用程序中,我有一个导航 Controller ,它连接到另一个 viewController(根 Controller )。在我的项目中,我导入了 ECSlidingViewController.h 和 .m。在将用作右侧菜单 (listViewController.h) 的 viewController 中,我导入了 ECSlidingViewController.h 并在 viewDidLoad 中这样做了:</p>
<pre><code>;
self.peekLeftAmount = 40.0f;
;
self.slidingViewController.underRightWidthLayout = ECVariableRevealWidth;
</code></pre>
<p>在 navigationController 类中,我这样做了(在导入 ECSlidingViewController.h 和 listViewController.h 之后):</p>
<pre><code>- (void)viewWillAppear:(BOOL)animated
{
;
if (!]) {
self.slidingViewController.underRightViewController= ;
}
;
}
</code></pre>
<p>但是当我运行应用程序时,当我到达代码行 <code>;</code> 应用程序崩溃,并给我以下错误:</p>
<pre><code>2013-09-28 01:59:55.629 Myapp *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -: object cannot be nil'
*** First throw call stack:
(
0 CoreFoundation 0x024595e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x01a6f8b6 objc_exception_throw + 44
2 CoreFoundation 0x0240bc3c - + 844
3 CoreFoundation 0x0240b8e0 - + 64
4 UIKit 0x0063f497 - + 208
5 Myapp 0x0001a934 - + 564
6 UIKit 0x006ec28a - + 419
7 UIKit 0x006ec798 - + 114
8 UIKit 0x006fd310 - + 199
9 UIKit 0x0097d627 - + 6236
10UIKit 0x006f478c - + 6433
11UIKit 0x006f4caf - + 130
12Myapp 0x00017447 - + 839
13UIKit 0x006ec2d8 - + 497
14UIKit 0x006ec867 - + 146
15UIKit 0x006ee22f __64-_block_invoke + 44
16UIKit 0x006ecbfa - + 63
17UIKit 0x005f1d59 ___afterCACommitHandler_block_invoke_2 + 33
18UIKit 0x005f1cde _applyBlockToCFArrayCopiedToStack + 403
19UIKit 0x005f1b2e _afterCACommitHandler + 568
20CoreFoundation 0x0242153e __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 30
21CoreFoundation 0x0242148f __CFRunLoopDoObservers + 399
22CoreFoundation 0x023ff3b4 __CFRunLoopRun + 1076
23CoreFoundation 0x023feb33 CFRunLoopRunSpecific + 467
24CoreFoundation 0x023fe94b CFRunLoopRunInMode + 123
25GraphicsServices 0x032da9d7 GSEventRunModal + 192
26GraphicsServices 0x032da7fe GSEventRun + 104
27UIKit 0x005d594b UIApplicationMain + 1225
28Myapp 0x00002b2b main + 235
29libdyld.dylib 0x01f54725 start + 0
30??? 0x00000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
</code></pre>
<p>请帮帮我!</p></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><pre><code>UIStoryboard *storyBoard = ;
UIViewController *MainView = ;
self.slidingViewController.topViewController = MainView;
</code></pre></p>
<p style="font-size: 20px;">关于iphone - viewWillAppear 时 ECSlidingViewController 错误(对象不能为 nil),我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/19062032/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/19062032/
</a>
</p>
页:
[1]