- (void)viewDidLoad {

    [super viewDidLoad];

for(int i=0;i<2;i++)

{

UIImage *img = [UIImage imageNamed:[NSString stringWithFormat:@"T%d.gif", i+1]];

UIImageView *imgView = [[UIImageView alloc] initWithImage:img];

imgView.frame = CGRectMake(scrollView.frame.size.width * i, 0, scrollView.frame.size.width, scrollView.frame.size.height);

[scrollView addSubview:imgView];

[img release];

}

[scrollView setContentSize:CGSizeMake(scrollView.frame.size.width * 2, scrollView.frame.size.height)];

paging.numberOfPages = 2;

}


-(void)scrollViewDidScroll:(UIScrollView *)sender{

CGFloat pageWidth = scrollView.frame.size.width;

int page = floor((scrollView.contentOffset.x - pageWidth/2) / pageWidth) + 1;

paging.currentPage = page;

}

'Object-C' 카테고리의 다른 글

archiving  (0) 2010.10.07
pickerView  (0) 2010.10.07
imagePicker  (0) 2010.10.07
pageControl  (0) 2010.10.07
ScrollView  (0) 2010.10.07
customCell  (0) 2010.10.07

+ Recent posts