我想知道你如何创建一个以按钮为对象的分页 UIScrollView?
到目前为止,我已经想办法用图像制作一个类似的 UIScrollView,它看起来像这样:
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
NSArray *pictures = [NSArray arrayWithObjects: [UIImage imageNamed:@"nr1"], [UIImage imageNamed:@"nr2"], nil];
for (int i = 0; i < pictures.count; i++) {
CGRect frame;
frame.origin.x = self.scrollView.frame.size.width * i;
frame.origin.y = 0;
frame.size = self.scrollView.frame.size;
UIImageView *subview = [[UIImageView alloc] initWithFrame:frame];
subview.image = [pictures objectAtIndex:i];
[self.scrollView addSubview:subview];
}
self.scrollView.contentSize = CGSizeMake(self.scrollView.frame.size.width * pictures.count, self.scrollView.frame.size.height);
}
任何教程将不胜感激:)