tarBarItem图标在Iphone上被砍掉了

时间:2011-12-30 20:28:55

标签: iphone tabs uitabbaritem

tabBarController = [[UITabBarController alloc] initWithNibName:nil bundle:nil];          
tabBarController.delegate = self;

UINavigationController *searchNav = [[[UINavigationController alloc] initWithRootViewController:search] autorelease];
searchNav.navigationBar.barStyle = UIBarStyleBlack;

[searchNav.tabBarItem initWithTitle:@"Search" image:[UIImage imageNamed:@"icn_find.png"] tag:0];


SettingsView *settings = [[[SettingsView alloc] initWithNibName:@"SettingsView" bundle:nil] autorelease];
settings.delegate = self;
UINavigationController *nav2 = [[[UINavigationController alloc] initWithRootViewController:settings] autorelease];
nav2.navigationBar.barStyle = UIBarStyleBlack;
[nav2.tabBarItem initWithTitle:@"Settings" image:[UIImage imageNamed:@"icn_Settings.png"] tag:1];

  tabBarController.viewControllers = [NSArray arrayWithObjects: searchNav, nav2, nil];

我遇到的问题是tabbaritem的图标图像被切断了。如何使其适合整个图标?

1 个答案:

答案 0 :(得分:2)

我认为您必须将图标大小调整为大约30x30(official reference)。

您也可以通过编程方式调整UIImage的大小,但对于这种类型的固定图像,手动调整大小会更明智。