导航返回按钮 直接返回写法

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

UIButton*rightButton = [[UIButton alloc]initWithFrame:CGRectMake(0,0,30,30)];
    
    [rightButton setImage:[UIImage imageNamed:@"search.png"]forState:UIControlStateNormal];
    
    [rightButton addTarget:self.navigationController action:@selector(popViewControllerAnimated:)forControlEvents:UIControlEventTouchUpInside];
    
    UIBarButtonItem*rightItem = [[UIBarButtonItem alloc]initWithCustomView:rightButton];
    
    self.navigationController.navigationItem.rightBarButtonItem = rightItem;