我有一個應用程序,我正在遷移到iOS 7. 但是,UIBarbuttonItem
沒有標題,但工作正常。 這裏是我的代碼:UIBarbuttonItem在ios上沒有標題7
UIBarButtonItem * uibbShare = [[[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"sharewhite.png"] style:UIBarButtonItemStylePlain target:self action:@selector(sharePressed:)] autorelease];
// uibbShare.width = 56.0; // uncommenting this doesn't change anything
uibbShare.title = @"Share";
然後我添加一些這些到工具欄與之間的一些靈活的空間項目。
...
[items addObject:flex2];
[items addObject:uibbShare];
...
[self.toolbar setItems:items animated:NO];
在iOS 7,他們沒有標題的所有,在iOS6的所有工作正常。你不能在ios7中創建這樣的barbuttons嗎?
更新上開發論壇同樣的問題:
UIBarButtonItem can't have both title and image?
What happened to the text under toolbar icons?
編輯:(7比6)
編輯2:(畫面從顯示,似乎文本消失了,並且幀/邊界是0 WTF)
我可以在下面看到的圖片比isHidden被選中。可能是這個問題? – RFG
它可能是,但它是一個內部視圖,不能(也不想)訪問它......奇怪的是,我不把它藏在任何地方,不要僅在上面的代碼行中使用工具欄在'viewDidLoad'中。如果我初始化它與標題(沒有圖像),它顯示文本...我想要兩個... – Templar
你可以以編程方式訪問此屬性並修改它?類似於UIButtonLabel.hidden = NO。 – RFG