首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >如何以编程方式删除/避免UIBarButtonItem上的小白光

如何以编程方式删除/避免UIBarButtonItem上的小白光
EN

Stack Overflow用户
提问于 2011-11-18 00:25:03
回答 1查看 366关注 0票数 0

我的问题与问题相同:How to disable the the light that appears when touching a UIBarButtonItem?

如果我们使用接口构建器,我已经阅读了答案。如果我以编程方式添加工具栏会怎么样?我怎样才能避开按钮上的亮光呢?

EN

回答 1

Stack Overflow用户

发布于 2011-11-18 00:50:42

通过编程来做你想做的事情,你可以这样做

代码语言:javascript
运行
复制
    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
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/8170641

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档