我的问题与问题相同:How to disable the the light that appears when touching a UIBarButtonItem?
如果我们使用接口构建器,我已经阅读了答案。如果我以编程方式添加工具栏会怎么样?我怎样才能避开按钮上的亮光呢?
发布于 2011-11-18 00:50:42
通过编程来做你想做的事情,你可以这样做
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 propertyhttps://stackoverflow.com/questions/8170641
复制相似问题