我的问题与问题相同:How to disable the the light that appears when touching a UIBarButtonItem?
如果我们使用Interface builder,我已经阅读了答案。如果以编程方式添加工具栏怎么办?如何避免条形按钮项上的指示灯?
答案 0 :(得分:0)
以编程方式执行您想要的操作
UIBarButtonItem *item;
UIButton *b2=[[UIButton alloc] initWithFrame:frame];
[b2 addTarget:self action:@selector(settings:) forControlEvents:UIControlEventTouchUpInside];
//you can set the background image or whatnot
[b2 setBackgroundImage:[UIImage imageNamed:@"settings.png"] forState:UIControlStateNormal];
item=[[UIBarButtonItem alloc] initWithCustomView:b2];
//then set the button on the UIToolbar through the items property