问题
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?
回答1:
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
来源:https://stackoverflow.com/questions/8170641/how-to-remove-avoid-small-white-splash-light-on-uibarbuttonitem-programmatically