- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
// Override point for customization after application launch.
self.window.backgroundColor = [UIColor whiteColor];
[self.window makeKeyAndVisible];
NSMutableArray* viewList = [NSMutableArray arrayWithCapacity:3];
for (NSInteger i = 0; i < 3; i++) {
UIViewController* viewController = [[[UIViewController alloc] init] autorelease];
viewController.title = @"クラムボンはかぷかぷわらったよ。";
[viewList addObject:viewController];
}
UITabBarController* tabBarController = [[[UITabBarController alloc] init] autorelease];
tabBarController.viewControllers = viewList;
self.window.rootViewController = tabBarController;
return YES;
}
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
// Override point for customization after application launch.
self.window.backgroundColor = [UIColor whiteColor];
[self.window makeKeyAndVisible];
NSMutableArray* viewList = [NSMutableArray arrayWithCapacity:3];
for (NSInteger i = 0; i < 3; i++) {
UIViewController* viewController = [[[UIViewController alloc] init] autorelease];
viewController.title = @"クラムボンはかぷかぷわらったよ。";
[viewList addObject:viewController];
}
UITabBarController* tabBarController = [[[UITabBarController alloc] init] autorelease];
tabBarController.viewControllers = viewList;
self.window.rootViewController = tabBarController;
// ーーーー ここから追加 ーーーー
NSArray* subviews = tabBarController.tabBar.subviews;
for (UIView* view in subviews) {
if ([view isKindOfClass:NSClassFromString(@"UITabBarButton")]) {
for (id item in view.subviews) {
if ([item isKindOfClass:NSClassFromString(@"UITabBarButtonLabel")]) {
CGRect frame = [[item valueForKey:@"frame"] CGRectValue];
if (view.frame.size.width < frame.size.width) {
NSLog(@"ラベルサイズを調整 %f -> %f", frame.size.width, view.frame.size.width);
frame.size.width = view.frame.size.width;
[item setValue:[NSValue valueWithCGRect:frame] forKey:@"frame"];
}
}
}
}
}
// ーーーー ここまで追加 ーーーー
return YES;
}
コメントする