Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/26.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone &引用;越界[0..1]”的;StackScrollView上的消息_Iphone_Objective C_Ios_Ipad_Ios5 - Fatal编程技术网

Iphone &引用;越界[0..1]”的;StackScrollView上的消息

Iphone &引用;越界[0..1]”的;StackScrollView上的消息,iphone,objective-c,ios,ipad,ios5,Iphone,Objective C,Ios,Ipad,Ios5,我试图在我的项目中实现StackScrollView(),但是,我希望从nib加载一堆视图,而不是一堆表视图。 我创建了一个按钮并将其添加到rootViewController.m - (void)viewDidLoad { [super viewDidLoad]; rootView = [[UIViewExt alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.siz

我试图在我的项目中实现StackScrollView(),但是,我希望从nib加载一堆视图,而不是一堆表视图。 我创建了一个按钮并将其添加到rootViewController.m

- (void)viewDidLoad {
    [super viewDidLoad];
    rootView = [[UIViewExt alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];
    rootView.autoresizingMask = UIViewAutoresizingFlexibleWidth + UIViewAutoresizingFlexibleHeight;
    [rootView setBackgroundColor:[[UIColor scrollViewTexturedBackgroundColor] colorWithAlphaComponent:0.6]];

    UIButton *buttonBar;

    buttonBar = [UIButton buttonWithType:UIButtonTypeCustom];
    [buttonBar setImage:[UIImage imageNamed:@"blue.png"] forState:UIControlStateNormal];
    [buttonBar setImage:[UIImage imageNamed:@"gray.png"] forState:UIControlStateSelected | UIControlStateHighlighted];
    buttonBar.frame = CGRectMake(9, 40, [UIImage imageNamed:@"www_gray.png"].size.width, [UIImage imageNamed:@"www_gray.png"].size.width);
    [buttonBar addTarget:self action:@selector(newPage) forControlEvents:UIControlEventTouchUpInside];
    [rootView addSubview:buttonBar];
}
下面是buttonBar调用的方法:

 -(void)newPage{
    UIDetailController *paginaGenerica = [[UIDetailController alloc] initWithNibName:@"UIDetailController" bundle:nil];
    [[StackScrollViewAppDelegate instance].rootViewController.stackScrollViewController addViewInSlider:paginaGenerica invokeByController:self isStackStartView:FALSE];
}
当我第一次按这个按钮时,一切正常。但是,当我再次触摸它时,我收到:

 2012-01-23 10:53:46.263 StackScrollView[1048:f803] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayM removeObjectAtIndex:]: index 2147483648 beyond bounds [0 .. 1]'
 *** First throw call stack:
事实上,当我尝试设置rootView动画(使整个内容向右移动,稍后在特定视图上滑动时返回)超过1次时,我也会收到相同的消息

但是,我向UIDetailController.m添加了相同的按钮和方法(使自己的视图在自身之上添加新视图,就像StackScrollView的原始实现中的TableView一样),然后,一切都完美地工作了

我认为问题出在“StackScrollViewController.m”中,但是,我对编程有点陌生,所以,我不理解代码的相同部分。如果有人已经与StackViewController合作过,并且遇到过这种情况,则可以帮助


谢谢。

当您第一次单击按钮时,请进行以下更改

[[StackScrollViewAppDelegate instance].rootViewController.stackScrollViewController addViewInSlider:paginaGenerica invokeByController:self isStackStartView:**TRUE**];
每次连续点击paginaGenerica视图

[[StackScrollViewAppDelegate instance].rootViewController.stackScrollViewController addViewInSlider:paginaGenerica invokeByController:self isStackStartView:FALSE];