UITabBarView 添加自定义图片

如app的创建的是基于UITabBarController的应用,可将如下代码加入到AppDelegate 的委托方法didFinishLaunchingWithOptions: 中
UITabBarController  *tabBarController = [[UITabBarController alloc] init];
NSArray *array = [tabBarController.view subviews];
UITabBar *tabBar = [array objectAtIndex:1];
UIImage *image = [UIImage imageWithContentsOfFile:sourcePath ];
tabBar.layer.contents = (id)image.CGImage;

你可能感兴趣的:(image)