首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > 移动开发 >

UINavigationBar,UIBarButtonItem 相干

2012-06-26 
UINavigationBar,UIBarButtonItem 相关1. Adding a Custom UIBarButtonItemWe will use an image in the r

UINavigationBar,UIBarButtonItem 相关
1. Adding a Custom UIBarButtonItem
We will use an image in the resources folder called “back.png”. To insert the image as the back button, add this piece of code to the AppDelegate.m file. This should be in the application:didFinishLaunchingWihOptions method.

if ([self.navigationController.navigationBar respondsToSelector:@selector( setBackgroundImage:forBarMetrics:)]){[self.navigationController.navigationBar setBackgroundImage:[UIImage imageNamed:@"navbar.png"] forBarMetrics:UIBarMetricsDefault];}


If you see, here we are asking if navbar will respondToSelector to avoid crash on iOS4!



热点排行