您的位置:首页 > 移动开发 > IOS开发

ios 点击navbar 标题栏 tableview返回顶部

2016-03-02 00:00 288 查看
1、设置navbar触摸事件

2、tableview返回顶部

- (void)viewDidLoad {
[super viewDidLoad];
self.navigationController.navigationBar.userInteractionEnabled=YES;
UITapGestureRecognizer * tap=[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(scrollToTop:)];
[self.navigationController.navigationBar addGestureRecognizer:tap];
}

-(void)scrollToTop:(UITapGestureRecognizer *)sender{
[self.tableView setContentOffset:CGPointMake(0,-50) animated:YES];
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: