标签栏图片未显示,请提供帮助。
我有AppDeligate文件:
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.recentView = [[RecentView alloc] initWithNibName:@"RecentView" bundle:nil];
self.groupsView = [[GroupView alloc] initWithNibName:@"GroupView" bundle:nil];
self.peopleView = [[PeopleView alloc] initWithNibName:@"PeopleView" bundle:nil];
self.settingsView = [[SettingsView alloc] initWithNibName:@"SettingsView" bundle:nil];
NavigationController *navController1 = [[NavigationController alloc] initWithRootViewController:self.recentView ];
NavigationController *navController3 = [[NavigationController alloc] initWithRootViewController:self.groupsView];
NavigationController *navController4 = [[NavigationController alloc] initWithRootViewController:self.peopleView];
NavigationController *navController5 = [[NavigationController alloc] initWithRootViewController:self.settingsView];
self.tabBarController = [[UITabBarController alloc] init];
self.tabBarController.viewControllers = @[navController1, navController3, navController4, navController5];
self.tabBarController.tabBar.translucent = NO;
//self.tabBarController.selectedIndex = DEFAULT_TAB;
self.window.rootViewController = self.tabBarController;
[self.window makeKeyAndVisible];
//---------------------------------------------------------------------------------------------------------------------------------------------
[self.recentView view];
[self.groupsView view];
[self.peopleView view];
[self.settingsView view];
return YES;
}
在我的一个视图控制器中,我有:
@implementation GroupView
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self)
{
[self.tabBarItem setImage:[UIImage imageNamed:@"groupimage"]];
self.tabBarItem.title = @"Groups";
}
return self;
}
- (void)viewDidLoad {
[super viewDidLoad];
self.title = @"Groups";
// Uncomment the following line to preserve selection between presentations.
// self.clearsSelectionOnViewWillAppear = NO;
// Uncomment the following line to display an Edit button in the navigation bar for this view controller.
// self.navigationItem.rightBarButtonItem = self.editButtonItem;
//self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(actionNew)];
}
我使用Xcode 7.2,目标设置为iOS 9。