如何自定义左上角的返回按钮

效果图:


代码如下:

//左上方返回图标

    UIImage * backImage = [[UIImage imageNamed:@"btn_nav_back.png"]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];

    //添加左边按钮

    UIBarButtonItem * backButtonItem = [[UIBarButtonItem alloc] initWithImage:backImage style:UIBarButtonItemStylePlain target:self action:@selector(didClickBackAction44:)];

    self.navigationItem.leftBarButtonItem = backButtonItem;

    self.view.backgroundColor = [UIColor whiteColor];


//导航栏的返回按钮

- (void)didClickBackAction44:(UIBarButtonItem *)bar

{

    [self.navigationController popViewControllerAnimated:YES];

}


你可能感兴趣的:(iOS学习,navigation,UITabBar,自定义返回按钮)