我正在尝试创建一组视图,然后我可以在我的申请人中滑动。
我试图在我的视图中设置我的数组确实加载然后将数组中的第一个视图加载到视图中。
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
self.title = @"Prototype";
//Initalizse the swipe gestuer listener
[self setupLeftSwipeGestureRecognizer];
[self setupRightSwipeGestureRecognizer];
//alloc and init viewcontroller nibs
self.detailViewA = [[DetailViewController alloc]initWithNibName:@"DetailViewController" bundle:[NSBundle mainBundle]];
self.detailViewB = [[DetailViewControllerB alloc]initWithNibName:@"DetailViewControllerB" bundle:[NSBundle mainBundle]];
self.detailViewC = [[DetailViewControllerC alloc]initWithNibName:@"DetailViewControllerC" bundle:[NSBundle mainBundle]];
// Create Array
viewArray = [NSArray arrayWithObjects:detailViewA_, detailViewB_, detailViewC_, nil];
// set detail View as first view
[self.view addSubview:[viewArray objectAtIndex:0]];
}
之后它崩溃了。并产生此消息。
2012-05-31 10:06:33.769 SMPrototypeB[2394:707] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[DetailViewController superview]: unrecognized selector sent to instance 0x131b00'