自定义后退按钮图像在导航栏上不起作用 [英] custom back button image does not work on the navigation bar

查看:51
本文介绍了自定义后退按钮图像在导航栏上不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个自定义的导航后退按钮.但是,当我添加此代码时,我的后向动画将不起作用,并且会随着动画一起返回.为什么?我认为这取决于我的@selector动作.

I created a custom navigation back button. But when I add this code, my back animation doesn't work and it goes back with animation. Why? I think it depends on my @selector action.

- (void)viewDidLoad {


    UIButton *button =  [UIButton buttonWithType:UIButtonTypeCustom];
    [button setImage:[UIImage imageNamed:@"goback.png"] forState:UIControlStateNormal];
    [button addTarget:self action:@selector(//HERE ! i don't know put what thing !) forControlEvents:UIControlEventTouchUpInside];
    [button setFrame:CGRectMake(0, 0, 32, 32)];
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:button];
}

推荐答案

好,我创建了一个函数,并且运行良好:D:

ok i created a function and works fine :D :

-(void)pushNav {
[self.navigationController popViewControllerAnimated:YES];  
}

这篇关于自定义后退按钮图像在导航栏上不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆