ios---setContentOffset

  UIView * farmeView=[[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.widthself.view.frame.size.height)];

    UITableView * conTentView=[[UITableView alloc] initWithFrame:CGRectMake(0, 110, self.view.frame.size.widthself.view.frame.size.height) style:UITableViewStyleGrouped ];

    conTentView.dataSource=self;

    conTentView.delegate = self;

    conTentView.separatorStyle=UITableViewCellSeparatorStyleNone;

    conTentView.backgroundColor=[UIColor whiteColor];

    conTentView. sectionIndexTrackingBackgroundColor=[UIColor greenColor];

    conTentView.tableHeaderView=[[UIView alloc] initWithFrame:CGRectMake(0, -10, 1, 1)];

    _table=conTentView;

    [conTentView setContentOffset:CGPointMake(0, 230) animated:YES];

 

     [farmeView addSubview:conTentView];

     [self.view addSubview:farmeView];

项目需要,记住上次位置,没有的话(初始化),使用默认位置,可以来点动画呦。

posted @ 2015-08-13 22:35  小毛驴  阅读(607)  评论(0编辑  收藏  举报