我想要从uibarbuttonitem中移除图像并将其恢复为默认按钮样式。我使用的设置customview为baritem的代码是:如何从UIBarButtonItem中删除CustomView?
UIButton *backButton = [UIButton buttonWithType:UIButtonTypeCustom];
backButton.frame = CGRectMake(0, 0, 79, 29.0);
[backButton setImage:[UIImage imageNamed:@"imagehere.png"] forState:UIControlStateNormal];
[self.myItem initWithCustomView:backButton];
所以我问什么我怎么能去掉后退按钮CustomView并拿回我的默认风格?谢谢。
删除它是不是self.myItem = [[ALLOC的UIBarButtonItem] initWithCustomView:返回按钮]泄漏存储器? – hennes 2011-03-13 19:24:40
@hennes:好点,你+1。 '[[[UIBarButtonItem alloc] initWithCustomView:backButton] autorelease]'然后。 – Anomie 2011-03-13 19:36:18
我认为这也取决于myItem的@property声明。 – hennes 2011-03-13 19:36:27