title: page control in uiscrollview
body: <p>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</p>
  
  <pre><code>// Email.h
  
  @interface Email : UIViewController&lt;UIScrollViewDelegate&gt;
  {
     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&lt;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;
  }
  </code></pre>