[英]How do I display a no-data splash UIView in a UITableViewController? Add and remove view from tableView?
[英]How do I display different view controllers in a uiview depending on selection through a tableview (Please see the image in description)?
為此,使用scrollView可以輕松實現您的要求:)
scrollView =[[UIScrollView alloc]init];
scrollView.frame =CGRectMake(0, 100, self.view.frame.size.width, self.view.frame.size.height - 60);
scrollView.pagingEnabled=YES;
scrollView.delegate=self;
scrollView.bounces=NO;
scrollView.showsHorizontalScrollIndicator = YES;
scrollView.showsVerticalScrollIndicator = NO;
scrollView.scrollsToTop=NO;
scrollView.indicatorStyle=UIScrollViewIndicatorStyleWhite;
[self.view addSubview:scrollView];
scrollView.contentSize=CGSizeMake(2*scrollView.frame.size.width, scrollView.frame.size.height - 60);
collectionantZ *homeScreen =[self.storyboard instantiateViewControllerWithIdentifier:@"yyy"];
Antzclubtableview *antzClub =[self.storyboard instantiateViewControllerWithIdentifier:@"xxx"];
tableView1.view.frame=CGRectMake(0,19,scrollView.frame.size.width, scrollView.frame.size.height);
tableView2.view.frame=CGRectMake(scrollView.frame.size.width,19,scrollView.frame.size.width, scrollView.frame.size.height);
[scrollView addSubview:tableView1.view];
[scrollView addSubview:tableView2.view];
[self addChildViewController:tableView1];
[self addChildViewController:tableView2];
- (IBAction)tableView1:(id)sender {
[scrollView setContentOffset:CGPointMake(0,0.) animated:YES];
}
- (IBAction)tableView2:(id)sender {
[scrollView setContentOffset:CGPointMake(1 *scrollView.frame.size.width,0.) animated:YES];
}
如果您有多個視圖控制器,只需根據需要調整此代碼
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.