gpt4 book ai didi

iphone - StackScrollView 上的 "beyond bounds [0 .. 1]"消息

转载 作者:行者123 更新时间:2023-11-28 17:38:47 24 4
gpt4 key购买 nike

我正在尝试将 StackScrollView ( https://github.com/Reefaq/StackScrollView ) 实现到我的项目中,但是,我想要一堆从 Nib 加载的 View ,而不是一堆 TableView 。我创建了一个按钮并将其添加到 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 设置动画时(使整个内容向右移动,稍后当我在特定 View 上滑动时返回)超过 1 次时,我收到了同样的消息。

但是,我将相同的按钮和方法添加到 UIDetailController.m(让自己的 View 在其自身之上添加新 View ,就像 tableViews 在 StackScrollView 的原始实现上工作一样),然后,一切正常。

我认为问题出在“StackScrollViewController.m”内部,但是,我是编程新手,所以,我不理解代码的相同部分。如果有人已经使用过 StackViewController 并且遇到过这种情况可能会有所帮助...

谢谢。

最佳答案

当你第一次点击按钮时做如下改变

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

对于 paginaGenerica View 的每次连续点击

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

关于iphone - StackScrollView 上的 "beyond bounds [0 .. 1]"消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8972191/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com