我的应用程序有点问题。
我正在使用ECSlidingViewController。
以下是概述:
在ViewController.h上:
#import <UIKit/UIKit.h>
#import <QuartzCore/QuartzCore.h>
#import "ECSlidingViewController.h"
#import "MenuViewController.h"
@interface ViewController : UIViewController
@property (strong, nonatomic) UIButton *menuBtn;
@end
在ViewController.m上:
#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController
@synthesize menuBtn;
- (void)viewDidLoad
{
[super viewDidLoad];
self.view.layer.shadowOpacity = 0.75f;
self.view.layer.shadowRadius = 10.0f;
self.view.layer.shadowColor = [UIColor blackColor].CGColor;
if (![self.slidingViewController.underLeftViewController isKindOfClass:[MenuViewController class]]) {
self.slidingViewController.underLeftViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"Menu"];
}
[self.view addGestureRecognizer:self.slidingViewController.panGesture];
self.menuBtn = [UIButton buttonWithType:UIButtonTypeCustom];
menuBtn.frame = CGRectMake(20, 27, 25, 21);
[menuBtn setBackgroundImage:[UIImage imageNamed:@"menuButton.png"] forState:UIControlStateNormal];
[menuBtn addTarget:self action:@selector(revealMenu:) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:self.menuBtn];
}
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
self.view.layer.shadowOpacity = 0.75f;
self.view.layer.shadowRadius = 10.0f;
self.view.layer.shadowColor = [UIColor blackColor].CGColor;
if (![self.slidingViewController.underLeftViewController isKindOfClass:[MenuViewController class]]) {
self.slidingViewController.underLeftViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"Menu"];
}
[self.view addGestureRecognizer:self.slidingViewController.panGesture];
}
- (IBAction)revealMenu:(id)sender
{
[self.slidingViewController anchorTopViewTo:ECRight];
}
@end
当我单击View Controller上的按钮时,它会创建ECSliding Effect,调出MenuViewController。在MenuViewController中,还有另一个按钮,它会调出testeViewController。
在testeViewController.h和testeViewController.m上,我添加了与ViewController完全相同的代码。但是,当我点击MenuViewController内部的按钮调出testeViewcController时,应用程序崩溃,出现此错误:
2013-08-04 18:50:16.174 FacttoBraziliPhone1[21477:c07] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSArrayM insertObject:atIndex:]: object cannot be nil'
*** First throw call stack:
(0x15ad012 0x12bae7e 0x1560b6a 0x1560a20 0x24ea3f 0xd01b 0x2e01c7 0x2e0232 0x2e04da 0x2f78e5 0x2f79cb 0x2f7c76 0x2f7d71 0x2f889b 0x2f8e93 0x2f8a88 0x654e63 0x646b99 0x646c14 0x12ce705 0x2022c0 0x202258 0x2c3021 0x2c357f 0x2c26e8 0x231cef 0x231f02 0x20fd4a 0x201698 0x260fdf9 0x260fad0 0x1522bf5 0x1522962 0x1553bb6 0x1552f44 0x1552e1b 0x260e7e3 0x260e668 0x1feffc 0x284d 0x2775)
libc++abi.dylib: terminate called throwing an exception
(lldb)
如果ViewController应该等于testeViewController,为什么我会崩溃? 有什么想法吗?
谢谢!
答案 0 :(得分:0)
这可能是ECSlidingViewController
的问题。我会升级到至少版本1.0.1。