定制的导航栏后退按钮图像不工作! [iPhone SDK] [英] custom Back Button image on the Navigation Bar doesn't Work ! [iPhone SDK]

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

问题描述

家伙,您好我创建一个自定义导航返回按钮,但是当我添加此code,我的背部动画不能正常工作,并与动画。为什么回去?我认为这取决于我的@selector行动吧!

   - (无效)viewDidLoad中{
    * UIButton的按钮= [UIButton的buttonWithType:UIButtonTypeCustom];
    [按钮setImage:[UIImage的imageNamed:@goback.png] forState:UIControlStateNormal];
    [按钮addTarget:自我行动:@selector(!//这里我不知道放什么东西!)forControlEvents:UIControlEventTouchUpInside];
    [按钮SETFRAME:CGRectMake(0,0,32,32)];
    self.navigationItem.leftBarButtonItem = [[的UIBarButtonItem页头] initWithCustomView:键];
}


解决方案

确定我创建了一个功能和正常工作:D:

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

Hi guys i create a custom navigation back button , but when i add this code , my back animation doesn't work and go 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];


}

解决方案

ok i created a function and works fine :D :

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

这篇关于定制的导航栏后退按钮图像不工作! [iPhone SDK]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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