我想要從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