2.UItabbarContoller
//탭 아이템 글자 색깔 지정
[UITabBarItem.appearance setTitleTextAttributes:
@{NSForegroundColorAttributeName : [UIColor whiteColor]} forState:UIControlStateNormal];
[UITabBarItem.appearance setTitleTextAttributes:
@{NSForegroundColorAttributeName : [UIColor colorWithRed:0/255.0f green: 162/255.0f blue:154/255.0f alpha:1.0]}
forState:UIControlStateSelected];
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7) {
for (UITabBarItem *tbi in self.tabBarController.tabBar.items) {
tbi.image = [tbi.image imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
}
}
}
//탭 초기화
UINavigationController *mainNavCon = [[UINavigationController alloc]initWithRootViewController:mainView];
[mainNavCon popViewControllerAnimated:YES];
mainNavCon.navigationBarHidden = YES;
UIImage *homeImg = [UIImage imageNamed:@"icon_home"];
mainNavCon.tabBarItem = [[UITabBarItem alloc]initWithTitle:@"홈" image:homeImg tag:0];
tabBarController.viewControllers = @[mainNavCon,myVocaNavCon, recentNavCon, GroupNavCon, settingNavCon];
//탭 백그라운드이미지설정
[[UITabBar appearance] setBackgroundImage:[UIImageimageNamed:@"bar_menu"]];
tabBarController.tabBar.translucent = true; // 탭바투명도 설정
[[UITabBar appearance]setTintColor:[UIColor colorWithRed:0/255.0f green:162/255.0f blue:154/255.0f alpha:1.0]];
[[UITabBar appearance] setSelectionIndicatorImage:[UIImage imageNamed:@“icon_cover"]]; //탭 선택시 인디케이트 이미지
//탭선택하기
self.tabBarController.selectedIndex = 0;
'ios 개발' 카테고리의 다른 글
ios objective c tableview 끝에서 data reload하기 (0) | 2017.08.21 |
---|---|
ios objective c tableview delegate method (0) | 2017.08.21 |
[ios] plist 읽어오기 및 쓰기 (0) | 2017.07.10 |
[arcjeen] 1. ios UILabel (0) | 2017.03.14 |
WRITTEN BY
- arcjeen
ios 관련문의 slimforce@naver.com