iPhone:UIScrollview具有多个UIImageView并具有放大/缩小效果
我的应用程序中有一个UIscrollview,其中包含多个UIimageview。我想应用收缩放大/缩小功能iPhone:UIScrollview具有多个UIImageView并具有放大/缩小效果,iphone,uiscrollview,uiimageview,zooming,Iphone,Uiscrollview,Uiimageview,Zooming,我的应用程序中有一个UIscrollview,其中包含多个UIimageview。我想应用收缩放大/缩小功能 self.view.backgroundColor = [UIColor viewFlipsideBackgroundColor]; [scViewObject setCanCancelContentTouches:NO]; scViewObject.indicatorStyle = UIScrollViewIndicatorStyleWhite; scViewO
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)];
self.view.backgroundColor=[UIColor viewFlipsideBackgroundColor];
[scViewObject SetCancelContentTouches:否];
scViewObject.indicatorStyle=UIScrollViewIndicatorStyleWhite;
scViewObject.clipsToBounds=否;//默认值为否,我们希望在scrollview中限制绘图
scViewObject.scrollEnabled=是;
scViewObject.alwaysBounceHorizontal=是;
scViewObject.PaginEnabled=是;
UIView*view=nil;
NSArray*子视图=[scViewObject子视图];
用于(子视图中的视图)
{
[视图从SuperView移除];
}
int左=20;
numberOfViewController=[ListOfImages count];
//NSMutableArray*控制器=[[NSMutableArray alloc]init];
用于(无符号ii=0;ii
这里的scViewObject是UIscrollview。请建议如何添加放大/缩小功能您需要观看两个ADC视频: WWDC 2010:使用滚动视图设计应用程序 WWDC 2011:高级滚动视图技术 但基本上,您需要在外部滚动视图的每个“页面”内实现缩放滚动视图,并将每个图像添加到这些缩放滚动视图中