标签:
在一个scrollview中横向有多个tableview,点击状态栏,tableview要返回到顶部
要将所有scrollview 以及tableview 的scrollToTop设置为NO。显示的tableview的scrollToTop设置为TRUE。
@property(nonatomic,strong) NSMutableArray *tdoclist;
//设置一个数组,存储tableview
 self.tdoclist=[NSMutableArray arrayWithCapacity:10];
    for (int i=0; i<[self.category count]+1; i++) {
        [[[CommenData alloc]init] setCategoryIndex:[self getCategoryIndex:i]];
        if (i==0) {
            self.doctable=[self.storyboard instantiateViewControllerWithIdentifier:@"docview"];
            self.doctable.view.frame=CGRectMake(r.size.width*i, 0.0, r.size.width, r.size.height-40);
            [self addChildViewController:self.doctable];
            self.doctable.tableView.scrollsToTop=YES;
            [self.tdoclist addObject:self.doctable];
            [self.tableScroll addSubview:self.doctable.view];
        }else{
            self.tdoctable=[self.storyboard instantiateViewControllerWithIdentifier:@"tdocview"];
            self.tdoctable.view.frame=CGRectMake(r.size.width*i, 0.0, r.size.width, r.size.height-40);
            [self addChildViewController:self.tdoctable];
            self.tdoctable.tableView.scrollsToTop=NO;
            [self.tdoclist addObject:self.tdoctable];
            [self.tableScroll addSubview:self.tdoctable.view];
        }
    }
//左右滑动页面切换tableview时切换 tableview的scrollToTop属性
标签:
原文地址:http://www.cnblogs.com/qiulilin/p/4541223.html