必须有办法做到这一点,但我找不到它.我有一个以编程方式创建的按钮:
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];
我想要的只是按钮在触摸时不以任何方式突出显示或改变外观.到目前为止,我在创建按钮时尝试了以下操作:
[button setBackgroundImage:[UIImage imageNamed:nil] forState:UIControlStateSelected | UIControlStateHighlighted];
和
[button setBackgroundImage:nil forState:UIControlStateSelected];
和
[button setAdjustsImageWhenHighlighted:NO];
和
button.showsTouchWhenHighlighted = NO;
然后在我尝试的按钮操作中:
[sender setHighlighted:!sender.isHighlighted];
和
[sender setSelected:!sender.isSelected];
这些都不起作用.