标签:
TableView+ScrollView
NSArray *subViews = cell.subviews;
for (UIView *view in subViews) {
[view removeFromSuperview];
}
//http://www.tuicool.com/articles/bE7JNnI
//http://www.mamicode.com/info-detail-470734.html
下面是用ScrollView的一段代码
1 - (void)viewDidLoad { 2 [super viewDidLoad]; 3 //控制条?不透明 4 self.navigationController.navigationBar.translucent = NO; 5 UIScrollView *scroll = [[UIScrollView alloc] init]; 6 scroll.frame = self.view.frame; 7 scroll.backgroundColor = [UIColor darkGrayColor]; 8 scroll.contentSize = CGSizeMake(self.view.frame.size.width*5, self.view.frame.size.height-64); 9 NSLog(@"%f",(double) self.navigationController.navigationBar.frame.size.height); 10 //一页一页的滑动 11 scroll.pagingEnabled = YES; 12 scroll.contentOffset = CGPointMake(self.view.frame.size.width*2,0); 13 [self.view addSubview:scroll]; 14 15 for (int i=0;i<5; i++) { 16 UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(image)]; 17 UIImageView *imageView = [[UIImageView alloc] init]; 18 imageView.userInteractionEnabled = YES; 19 imageView.frame = CGRectMake(self.view.frame.size.width*i, 0, self.view.frame.size.width, self.view.frame.size.height-64); 20 NSLog(@"%f",(double) self.navigationController.navigationBar.frame.size.height); 21 imageView.image = [UIImage imageNamed:[NSString stringWithFormat:@"t%d.png",i+1]]; 22 [imageView addGestureRecognizer:tap]; 23 [scroll addSubview:imageView]; 24 } 25 // Do any additional setup after loading the view, typically from a nib. 26 } 27 28 - (void)image{ 29 FirstViewController *firstVC = [FirstViewController new]; 30 [self.navigationController pushViewController:firstVC animated:YES]; 31 }
[某鸥实训记][objective-c][第五天][个人笔记]
标签:
原文地址:http://www.cnblogs.com/NyaSu/p/4801933.html