在视图控制器上,我有一个带有自定义图像的后退按钮
UIButton *backButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 32, 32)];
[backButton setImage:[UIImage imageNamed:@"left207.png"] forState:UIControlStateNormal];
[backButton addTarget:self action:@selector(goToParent) forControlEvents:UIControlEventTouchUpInside];
UIBarButtonItem *backBtn = [[UIBarButtonItem alloc] initWithCustomView:backButton];
self.navigationItem.leftBarButtonItem = backBtn;
self.navigationItem.rightBarButtonItem = rightButton;
但是当我运行应用程序时,没有任何推动效果。它不会变暗一秒钟。
答案 0 :(得分:0)
您需要为突出显示的状态设置另一个图像:
[backButton setImage:[UIImage imageNamed:@"highlightedButton"] forState:UIControlStateHighlighted];