一、設置navbar觸摸事件
code
二、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]; }