如何以编程方式删除/避免UIBarButtonItem上的白色小飞溅光 [英] How to remove/avoid small white splash light on UIBarButtonItem programmatically
本文介绍了如何以编程方式删除/避免UIBarButtonItem上的白色小飞溅光的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
My issue is same as question: How to disable the the light that appears when touching a UIBarButtonItem?
如果我们使用界面构建器",我已经阅读了答案.如果我以编程方式添加工具栏怎么办?如何避免在条形按钮项目上出现亮灯?
I have read answer if we use Interface builder. What if I add toolbar programmatically? How can I avoid the light on the bar button item?
推荐答案
要以编程方式完成您想做的事情
To do what you want programatically you can do
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
这篇关于如何以编程方式删除/避免UIBarButtonItem上的白色小飞溅光的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文