iOS Developer Libraryのサンプルコード、PageControlを使用しています。私が何をしたいかUIScrollView、ボタンのクリックがうまくいかない...
だから、これは私がやったことあるボタンが
2ページに行くをクリックすると
1)MyView.xib
2)にボタンを追加することです。
1)次に、PhoneContentController.mで作成し、以下の方法は、2ページ目に移動するには
- (IBAction)toPageTwo:(id)sender;
{
NSLog(@"button clicked...");
PhoneContentController * callSview = [[PhoneContentController alloc] init];
[callSview showPage:2];
}
のように "MyViewController.m" にIBAction作成さMyView.xib
でボタン 2)を作成しました。ボタンがクリックされた場合
[scrollView setContentOffset:CGPointMake(320*(page -1), 0) animated:YES];
- (void)showPage:(int)page;
{
[scrollView setContentOffset:CGPointMake(320*(page -1), 0) animated:YES];
NSLog(@"Method called..and the scrollview width is %f ", scrollView.frame.size.width);
//prints negative value or 0.000. why?
}
問題は動作しません。 (PhoneContentController.m内でshowPageが呼び出された場合は正常に動作しています)
何か提案がありますか?
Interface BuilderのIBActionコンセントにボタンを接続しましたか? – Dancreek