// Email.h@interface Email : UIVIEwController<uiscrollviewdelegate>{ UIPageControl *pageControl; UIScrollVIEw *scroller;}@property (nonatomic,retain)IBOutlet UIPageControl *pageControl;@property (nonatomic,retain)IBOutlet UIScrollVIEw *scroller;-(IBAction)clickPageControl:(ID)sender;@end// Email.m@implementation Email@synthesize pageControl,scroller;-(IBAction)clickPageControl:(ID)sender{ int page=pageControl.currentPage; CGRect frame=scroller.frame; frame.origin.x=frame.size.wIDth=page; frame.origin.y=0; [scroller scrollRectToVisible:frame animated:YES];}-(voID)scrollVIEwDIDEndDecelerating:(UIScrollVIEw *)scrollVIEw{ int page = scrollVIEw.contentOffset.x/scrollVIEw.frame.size.wIDth; pageControl.currentPage=page;}- (voID)vIEwDIDLoad { [super vIEwDIDLoad]; self.Title=@"Press Photos"; for (int i=1; i<10; i++) { UIImageVIEw *images=[[UIImageVIEw alloc]initWithImage: [UIImage imagenamed:[Nsstring stringWithFormat:@"%d.jpg",i]]]; images.frame=CGRectMake((i-1)*320,320,460); [scroller addSubvIEw:images]; [images release]; } scroller.delegate=self; scroller.contentSize=CGSizeMake(320*9,460); scroller.pagingEnabled=YES; pageControl.numberOfPages=9; pageControl.currentPage=0;}解决方法
frame.origin.x=frame.size.wIDth=page;
应该
frame.origin.x = frame.size.wIDth * page;总结
以上是内存溢出为你收集整理的objective-c – uiscrollview中的页面控制全部内容,希望文章能够帮你解决objective-c – uiscrollview中的页面控制所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)