Ios 录制UIBar按钮项目时为白色

Ios 录制UIBar按钮项目时为白色,ios,objective-c,Ios,Objective C,我使用下面的代码创建了一个自定义栏按钮项 UIImage* image3 = [UIImage imageNamed:@"iphone-btn-next@2x.png"]; CGRect frameimg = CGRectMake(0, 0,57,44); UIButton *someButton = [[UIButton alloc] initWithFrame:frameimg]; [someButton setBackgroundImage:image3 forState:UIContro

我使用下面的代码创建了一个自定义栏按钮项

UIImage* image3 = [UIImage imageNamed:@"iphone-btn-next@2x.png"];
CGRect frameimg = CGRectMake(0, 0,57,44);
UIButton *someButton = [[UIButton alloc] initWithFrame:frameimg];
[someButton setBackgroundImage:image3 forState:UIControlStateNormal];
[someButton setBackgroundImage:image3 forState:UIControlStateHighlighted];
[someButton addTarget:self action:@selector(flipView)
     forControlEvents:UIControlEventTouchUpInside];
[someButton setShowsTouchWhenHighlighted:YES];
UIBarButtonItem *mailbutton =[[UIBarButtonItem alloc] initWithCustomView:someButton];
self.navigationItem.rightBarButtonItem=mailbutton;
它工作正常,但问题是当我点击按钮时,我可以看到按钮中心的白色(见屏幕截图)。有人能给我建议一下摆脱这种状况的方法吗


删除这行代码:

[someButton setShowsTouchWhenHighlighted:YES];
根据文件

showsTouchWhenHighlighted => A Boolean value that determines whether tapping the button causes it to glow.

这应该是书面回答

拆线

[someButton setShowsTouchWhenHighlighted:YES];
试试这个

UIImage* image3 = [UIImage imageNamed:@"iphone-btn-next@2x.png"];
CGRect frameimg = CGRectMake(0, 0,57,44);
UIButton *someButton = [[UIButton alloc] initWithFrame:frameimg];
[someButton setBackgroundImage:image3 forState:UIControlStateNormal];
[someButton setBackgroundImage:image3 forState:UIControlStateHighlighted];
[someButton addTarget:self action:@selector(flipView)
forControlEvents:UIControlEventTouchUpInside];
UIBarButtonItem *mailbutton =[[UIBarButtonItem alloc] initWithCustomView:someButton];
self.navigationItem.rightBarButtonItem=mailbutton;

尝试删除此行
[someButton Setshowstouch when highlighted:YES]