There must be a way to do this, but I cannot find it. I have a button that I created programmatically:
UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect]; button.frame = CGRectMake(25, self.view.frame.size.height/4, 200, 350); [button setTitle:@"Inbox" forState:UIControlStateNormal]; [button addTarget:self action:@selector(popViewController:) forControlEvents:UIControlEventTouchUpInside]; [self.view addSubview:button];
All I want is a button so as not to highlight or change the appearance in any way when it touches. So far, I tried when creating a button:
[button setBackgroundImage:[UIImage imageNamed:nil] forState:UIControlStateSelected | UIControlStateHighlighted];
and
[button setBackgroundImage:nil forState:UIControlStateSelected]
AND
[button setAdjustsImageWhenHighlighted:NO]
and
button.showsTouchWhenHighlighted = NO;
Then in the button action, I tried:
[sender setHighlighted:!sender.isHighlighted]
and
[sender setSelected:!sender.isSelected]
None of these works.
ios objective-c uibutton
jac300
source share