Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/27.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 选项卡栏图像不显示_Ios_Objective C_Uitabbar - Fatal编程技术网

Ios 选项卡栏图像不显示

Ios 选项卡栏图像不显示,ios,objective-c,uitabbar,Ios,Objective C,Uitabbar,选项卡栏图像未显示,请帮助 我拥有的AppDeligate文件: @implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // Override point for customization after application launch. self.w

选项卡栏图像未显示,请帮助

我拥有的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。

在视图控制器的代码中,您在哪里设置了
self.tabBarItem.image
?为什么在显示窗口后要引用所有视图控制器的
视图
?我正在为所有视图创建选项卡,这就是为什么我要引用所有视图的原因请将代码放入您的问题中,不是在注释中。我已经在等式中添加了视图控制器的代码