我正在嘗試將image
添加到UITabbar
。目前它有一個黑色的默認閃耀。我想要一個像下面一樣的純色。我怎樣才能將這個添加到xib中的UITabbar
?如何將圖像添加到UITabbar?
0
A
回答
1
試試這個
UIImage* tabBarBackground = [UIImage imageNamed:@"tabbar.png"];
[[UITabBar appearance] setBackgroundImage:tabBarBackground];
[[UITabBar appearance] setSelectionIndicatorImage:[UIImage imageNamed:@"tabbar_selected.png"]];
0
要自定義中的UITabBar一樣,iOS 5中提供了一個API,讓你改變的TabBar的背景圖像。
// ios 5 code here
UIImage *tabBackground = [[UIImage imageNamed:@"tab_bg"]
resizableImageWithCapInsets:UIEdgeInsetsMake(0, 0, 0, 0)];
[[UITabBar appearance] setBackgroundImage:tabBackground];
[[UITabBar appearance] setSelectionIndicatorImage:
[UIImage imageNamed:@"tab_select_indicator"]];
// ios 4 code here
CGRect frame = CGRectMake(0, 0, 480, 49);
UIView *tabbg_view = [[UIView alloc] initWithFrame:frame];
UIImage *tabbag_image = [UIImage imageNamed:@"PB_MD_footer_navBg_v2.png"];
UIColor *tabbg_color = [[UIColor alloc] initWithPatternImage:tabbag_image];
tabbg_view.backgroundColor = tabbg_color;
[tabBar insertSubview:tabbg_view atIndex:0];
感謝,
0
viewTab1controller = [[ViewTab1Controller alloc] initWithNibName:@"ViewTab1" bundle:nil];
viewTab1controller.title = @"Schedules";
navigationTab1Controller = [[[UINavigationController alloc] initWithRootViewController:viewTab1controller] autorelease];
navigationTab1Controller.tabBarItem.image = [[UIImage imageNamed:@"Match.png"] autorelease];
[viewTab1controller release];
相關問題
- 1. 如何添加UITabBarItem到UITabBar
- 2. 添加圖片到UITabBar
- 3. 如何將圖像添加到位圖
- 4. 如何將圖像添加到視圖
- 5. 如何將圖像添加到JButton
- 6. 如何將圖像添加到ToolStripMenuItem
- 7. 如何將圖像添加到sqlite ListView?
- 8. 如何將空圖像添加到表
- 9. 如何將圖像添加到UIBarButtonItem?
- 10. 如何將圖像添加到標籤?
- 11. 如何將圖像添加到UIAlertView?
- 12. 如何將圖像值添加到h:commandlink?
- 13. 如何將文字添加到圖像
- 14. 如何將圖像添加到數組?
- 15. 如何將圖像添加到比例?
- 16. Java:如何將圖像添加到Jlabel?
- 17. 如何將圖像添加到TreeView.Tag?
- 18. 如何將圖像添加到TextView中
- 19. 如何將圖像添加到畫布
- 20. 如何將圖像添加到ListView?
- 21. 如何將圖像添加到UIView
- 22. 如何將圖像添加到Tabhost
- 23. 如何將圖像添加到按鈕?
- 24. 如何將圖像添加到cloud9?
- 25. Swift:如何將圖標圖像和圖像背景添加到App委託中的UItabBar?
- 26. 將UITabBarItem添加到UIViewController中的UITabBar中
- 27. 將UINavigation添加到UITabBar應用程序
- 28. HTML + CSS:如何將陰影(如圖像)添加到圖像?
- 29. 如何將圖像添加到圖像視圖
- 30. 如何將多個圖像添加到圖像視圖
我會盡量回來到u今天本身由於 – Navi
閱讀的鏈接也將幫助你很多 –
感謝,這是爲我工作 – Navi