【发布时间】:2012-07-25 14:53:47
【问题描述】:
我在按下 UIToolbar 控件中的 UIBarButtonItem 时出现了一个奇怪的发光问题。当我将ImageInsets 属性设置为4,0,0,0 时,每次点击它时,发光都会变小。这是一个插图:
如果我不设置 imageInsets,问题不会出现。 UIToolbar 中的所有按钮都会出现问题。我没有水龙头处理程序。制作更大的插图(例如 8,0,0,0)更快地产生相同的结果。
感谢任何有关如何解决问题的建议。
编辑:将代码更改为 Objective-C,因为问题在没有 MonoTouch 的情况下也会重现。
这是默认的单视图项目。我使用情节提要设计器在其中添加了一个工具栏和一个 UIBarButtonItem。为按钮创建了一个插座。
#import "ViewController.h"
@implementation ViewController
@synthesize testBtn;
#pragma mark - View lifecycle
- (void)viewDidLoad
{
[super viewDidLoad];
UIEdgeInsets insets = UIEdgeInsetsMake(8, 0, 0, 0);
[testBtn setImageInsets:insets];
}
- (void)viewDidUnload
{
[self setTestBtn:nil];
[super viewDidUnload];
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
}
@end
【问题讨论】: