UITabBarItem.image正確的大小我創建了一個編程的UITabBarController如下:故障顯示的iOS 7
UITabBarController *tbc = [[UITabBarController alloc] init];
[tbc setViewControllers:[NSArray arrayWithObjects:vc1,vc2,vc3,vc4,vc5,nil]];
其工作正常。對於每個UIViewControllers的,我想他們的tabbaritem.image設置爲指定的圖像,所以我這樣做:
UITabBarItem *tbi1 = [[UITabBarItem alloc] initWithTitle:@"Search" image:
[UIImage imageNamed:@"tab_bar_search_50_50.png"] tag:0];
vc1.tabBarItem = tbi1;
,我也試圖
vc1.tabBarItem.image = [UIImage imageNamed:@"tab_bar_search_50_50.png"];
和
UITabBarItem *tbi1 = [[UITabBarItem alloc] initWithTitle:@"Search" image:
[UIImage imageNamed:@"tab_bar_search_50_50.png"] selectedImage:
[UIImage imageNamed:@"tab_bar_search_50_50.png"]];
圖像大小爲50x50,因爲根據蘋果 - >https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/MobileHIG/IconMatrix.html#//apple_ref/doc/uid/TP40006556-CH27-SW1
一個tabbar圖標尺寸「約50×50(最大:96×64)是可以的」。然而,當我在模擬器和設備(兩個視網膜屏幕)上運行這個圖像時,圖像太大,掛在標籤欄的頂部。
我甚至試圖將@ 2x作爲後綴添加到不起作用的文件名中,但是我認爲應用程序僅爲ios7構建,而這些不再需要?
我猜這個問題或者是iOS7中的一個bug,或者問題在於圖片大小,但是我在文檔中看過,如果圖片太大,它會被剪裁到某個邊界?
泰勒德登你的意思是說像命名不應該有@ 2x的後綴,但是視網膜或非視網膜的圖像大小應該如何。 – Arpi