UITabBarItem을 사용자 정의하려고하는데 이미지의 위치에 문제가 있습니다.UITabBarItem finishedImageSelected가 탭 바를 오프셋으로 배치했습니다.
화상 사이즈는로서의 UITabBar 81px X 1600 픽셀, 동일한 높이이다. 내가 사용으로, 코드가 같은 API를 사용하여 내가 구글에서 검색 및 this tutorial을 발견했습니다
// AppDelegate
BlocosController *blocos = [[[BlocosController alloc] initWithManagedObjectContext:moc] autorelease];
UINavigationController *navBlocos = [[[UINavigationController alloc] initWithRootViewController:blocos] autorelease];
tabBarController = [[UITabBarController alloc] initWithManagedObjectContext:moc];
tabBarController.viewControllers = [NSArray arrayWithObjects: navData, navBlocos, navBairro, navAtualizar, nil];
// ...
// BlocosController.m
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
self.tabBarItem = [[[UITabBarItem alloc] initWithTitle:TITLE image:nil tag:10] autorelease];
[[self tabBarItem] setFinishedSelectedImage:[UIImage imageNamed:@"tab_bar_blocos_selected"] withFinishedUnselectedImage:[UIImage imageNamed:@"tab_bar_blocos_unselected"]];
}
return self;
}
예상대로 작동합니다 : 이것은 내가 이미지를 설정하는 방법입니다.이 기사의 코드는 마치 내 동작과 비슷하지만 배경이 같은 색이기 때문에 올바르게 배치되었다는 환상이 있습니다.
왜 finishedImageSelected이고 선택되지 않은 탭 탭이 정렬되지 않은 위치에 있습니까? 그것을 고치는 방법?
같은 문제가 발생했습니다 ... – meadlai