2012-01-23 3 views
1

私は自分のプロジェクトにStackScrollView(https://github.com/Reefaq/StackScrollView)を実装しようとしていますが、tableviewsのスタックの代わりに、nibからロードされたビューのスタックが必要です。 ボタンを作成し、それをrootViewController.mに追加しました。私が最初にボタンをタッチすると"bounds [0. .. 1]"のメッセージStackScrollView

-(void)newPage{ 
    UIDetailController *paginaGenerica = [[UIDetailController alloc] initWithNibName:@"UIDetailController" bundle:nil]; 
    [[StackScrollViewAppDelegate instance].rootViewController.stackScrollViewController addViewInSlider:paginaGenerica invokeByController:self isStackStartView:FALSE]; 
} 

は、すべてが正常に動作します:

- (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が呼び出すメソッドです。しかし、私は再びそれをタッチすると、私はこの受信:私はときに私rootViewは(、右にコンテンツ全体の動きを行い、後で戻ってくるアニメーション化しようとすると、実際には

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: 

を、私はこの同じメッセージが表示されます特定のビューでスワイプ)を1回以上繰り返します。

しかし、UIDetailController.mに同じボタンとメソッドを追加します(独自のViewをStackViewViewの元の実装で動作するように新しいビューを追加するようにしてください)。

私はこの問題が "StackScrollViewController.m"の内部にあると思うが、私はプログラミングに新しいことがあるので、コードの同じ部分を理解できなかった。もし誰かが既にStackViewControllerで作業していて、この状況に直面しているのであれば、助けてください。

ありがとう。

答えて

0

初めてボタンをクリックしpaginaGenericaビューに

[[StackScrollViewAppDelegate instance].rootViewController.stackScrollViewController addViewInSlider:paginaGenerica invokeByController:self isStackStartView:FALSE]; 
を次のように変更

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

、すべての連続したクリックのためを作ります