2011-12-20 68 views
0

多的UIImageView我在我的應用程序,它包含多個UIImageView的一個UIScrollView。我想輸入/輸出functionality.Code申請擠捏縮放添加的UIImageView到UIScrollView的是以下iPhone:UIScrollView中與放大/縮小效果

self.view.backgroundColor = [UIColor viewFlipsideBackgroundColor]; 
    [scViewObject setCanCancelContentTouches:NO]; 
    scViewObject.indicatorStyle = UIScrollViewIndicatorStyleWhite; 
    scViewObject.clipsToBounds = NO;  // default is NO, we want to restrict drawing within our scrollview 
    scViewObject.scrollEnabled = YES; 
    scViewObject.alwaysBounceHorizontal=YES; 
    scViewObject.pagingEnabled = YES; 

    UIView *view = nil; 
    NSArray *subviews = [scViewObject subviews]; 
    for (view in subviews) 
    { 
     [view removeFromSuperview]; 
    } 
    int left=20; 
    numberOfViewController=[ListOfImages count]; 
    //NSMutableArray *controllers = [[NSMutableArray alloc] init]; 
    for (unsigned ii = 0; ii < numberOfViewController; ii++) 
    { 
     UIImageView *temp=[[UIImageView alloc] init]; 
     temp.contentMode=UIViewContentModeScaleAspectFit; 
     temp.userInteractionEnabled = YES; 
     temp.multipleTouchEnabled = YES; 
     temp.clipsToBounds = YES; 
     temp.image=[ListOfImages objectAtIndex:ii]; 
     temp.frame=CGRectMake(left, 0, 280, 365); 
     temp.tag=ii; 

     [scViewObject addSubview:temp]; 
     left=left+320; 
    } 

    [scViewObject setContentSize:CGSizeMake((numberOfViewController * kScrollObjWidth), 365)]; 

這裏scViewObject是UIScrollView的。請建議我如何能輸入/輸出功能添加變焦

回答

1

有一對夫婦ADC的視頻,你會想要看:

WWDC 2010:設計應用程序與滾動視圖

WWDC 2011:高級滾動型技術

但基本上你要實現每個「頁」外滾動視圖內縮放滾動視圖和每個圖像添加到每個這些縮放滾動視圖。

Also see the documentation And example code