0

SIGABRTエラーが発生し、本当にイライラしています。助けてください。エラーはアプリデリゲートの何かの結果であることがわかっています。コードを数回調べてストーリーボードを確認しましたが、問題はありません。Parseでさえ適切にコンパイルされています。

#import "AppDelegate.h"
#import <Parse/Parse.h>

@implementation AppDelegate 

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
//  Parse Initialization

.....


//Custom Stuff Initialization

[[UINavigationBar appearance] setBackgroundImage:[UIImage imageNamed:@"navigationBar"] forBarMetrics:UIBarMetricsDefault];

// Assign tab bar item with titles
UITabBarController *tabBarController = (UITabBarController *)self.window.rootViewController;
UITabBar *tabBar = tabBarController.tabBar;
UITabBarItem *tabBarItem1 = [tabBar.items objectAtIndex:0];
UITabBarItem *tabBarItem2 = [tabBar.items objectAtIndex:1];
UITabBarItem *tabBarItem3 = [tabBar.items objectAtIndex:2];
UITabBarItem *tabBarItem4 = [tabBar.items objectAtIndex:3];

tabBarItem1.title = @"Dashboard";
tabBarItem1.titlePositionAdjustment = UIOffsetMake(0.0, -5.5);
tabBarItem2.title = @"Interactions";
tabBarItem2.titlePositionAdjustment = UIOffsetMake(0.0, -5.5);
tabBarItem3.title = @"Messages";
tabBarItem3.titlePositionAdjustment = UIOffsetMake(0.0, -5.5);
tabBarItem4.title = @"Me";
tabBarItem4.titlePositionAdjustment = UIOffsetMake(0.0, -5.5);

[tabBarItem1 setFinishedSelectedImage:[UIImage imageNamed:@"pen_sIMG.png"] withFinishedUnselectedImage:[UIImage imageNamed:@"pen_usIMG.png"]];
[tabBarItem2 setFinishedSelectedImage:[UIImage imageNamed:@"comment_sIMG.png"] withFinishedUnselectedImage:[UIImage imageNamed:@"comment_usIMG.png"]];
[tabBarItem3 setFinishedSelectedImage:[UIImage imageNamed:@"message_sIMG.png"] withFinishedUnselectedImage:[UIImage imageNamed:@"message_usIMG.png"]];
[tabBarItem4 setFinishedSelectedImage:[UIImage imageNamed:@"star_sIMG.png"] withFinishedUnselectedImage:[UIImage imageNamed:@"star_usIMG.png"]];


// Change the tab bar background
UIImage* tabBarBackground = [UIImage imageNamed:@"tabBarBg-icns.png"];
[[UITabBar appearance] setBackgroundImage:tabBarBackground];
[[UITabBar appearance] setSelectionIndicatorImage:[UIImage imageNamed:@"tabBarBg-selc.png"]];

// Change the title color of tab bar items
UIColor *titleNormColor = [UIColor colorWithRed:137/255.0 green:137/255.0 blue:137/255.0 alpha:1.0];
[[UITabBarItem appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
                                                   titleNormColor, UITextAttributeTextColor,
                                                   nil] forState:UIControlStateNormal];


UIColor *titleHighlightedColor = [UIColor colorWithRed:73/255.0 green:130/255.0 blue:202/255.0 alpha:1.0];
[[UITabBarItem appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
                                                   titleHighlightedColor, UITextAttributeTextColor,
                                                   nil] forState:UIControlStateHighlighted];


return YES;
}



@end
4

1 に答える 1

-1

あなたのコードの下の行は間違っています

UITabBarController *tabBarController = (UITabBarController *)self.window.rootViewController;

UIViewControllerself.window.rootViewController;のみを返すためです。UITabBarControllerではありません

正しいコードは

 UITabBarController *tabBarController = self.window.rootViewController.tabBarController;
于 2013-02-22T01:47:46.230 に答える