2011-07-19 7 views
1

ページスクロールビューを実装する必要があります。各ページビューは別々のView Controllerをロードする必要があります。ビューコントローラでアクション/イベントを実行すると、ページビューを更新/更新する必要がありますか?はいの場合、どうですか?この点について私に指摘することができれば非常に感謝しています。ページスクロールビューとその相互作用に複数のビューコントローラをロードする

答えて

0
-(void)createScrollView 
{ 
myScroll = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, 320, 440)]; 
myScroll.pagingEnabled = YES; 
myScroll.showsHorizontalScrollIndicator = YES; 
myScroll.showsVerticalScrollIndicator = YES; 
myScroll.scrollsToTop = NO; 
myScroll.delegate = self; 
int n = [array count]; 
myScroll.contentSize = CGSizeMake((320 * n), 440); // n = number of views 

for (int i = 0 , X = 0; i < [photoArray count]; i++ , X += 320) 
{ 
    UIImageView *img =[[UIImageView alloc]initWithFrame:CGRectMake(X,0, 320, 480)]; //here view for you 

    CGRect frame; 
    frame.size.width=320; frame.size.height=240; 
    frame.origin.x=0; frame.origin.y=88; 


    [img addSubview:asyncImage]; 
    img.contentMode=UIViewContentModeScaleAspectFit;    

    [myScroll addSubview:img]; 
} 
} 

- (void) viewDidLoad 
    { 
[self createScrollView]; 
[myScroll scrollRectToVisible:CGRectMake(320*photoNumber, 0, 320 , 240) animated:NO]; 
[self.view addSubview:myScroll];   
    } 

そのサンプルコード....変更でそれを試してみてください...最後にあなたのために働くの希望...

関連する問題