i ve created a uiscrollview containing a page control which loads the images from resource bundle..everything works good.i m able to scroll through different images..the problem is if i m to click the corresponding pagecontrol(dot), i m not able to navigate to the corresponding image....could u guys help me out below is the code...the below code works perfectly fine
// 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=scro开发者_JAVA百科ller.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, 0, 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;
should be
frame.origin.x = frame.size.width * page;
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论