RDVTabBarController : A는 매우 멈추지 멋진 첨자의 수를 자기 - 정의 할 수 있습니다, tabBarController 소리.
RDVTabBarController 주소 : RDVTabBarController
데모 주소 : 오신 것을 환영합니다 스타
설명
이 튜토리얼은 당신이 신속하게 시작 할 수 있도록하기위한 것입니다 좀 더 깊이있는 이해를 위해, 제발 RDVTabBarController 주소 분석.;
용도
pod 'RDVTabBarController'
구조
RDVTabBar
@interface RDVTabBar : UIView
RDVTabBarController
@interface RDVTabBarController : UIViewController
RDVTabBarItem
@interface RDVTabBarItem : UIControl
RDVTabBarController 사용 예제는 이미 매우 상세하고 초기화를 보면됩니다
//VString宏定义,为了就是更好的国际化语言,适配多语言,刚好此Demo也国际化了,可以参看https://github.com/sauchye/dev_notes/issues/4
#define VString(x) NSLocalizedString(x, nil)
- (void)setupViewControllers{
SYFirstViewController *firstVC = [[SYFirstViewController alloc] init];
SYSecondViewController *secondVC = [[SYSecondViewController alloc] init];
SYThirdViewController *thirdVC = [[SYThirdViewController alloc] init];
firstVC.title = VString(@"Home");
secondVC.title = VString(@"Found");
thirdVC.title = VString(@"Me");
self.firstNav = [[SYBaseNavigationController alloc] initWithRootViewController:firstVC];
self.secondNav = [[SYBaseNavigationController alloc] initWithRootViewController:secondVC];
self.thirdNav = [[SYBaseNavigationController alloc] initWithRootViewController:thirdVC];
[self setViewControllers:@[self.firstNav, self.secondNav, self.thirdNav]];
[self customizeTabBarForController];
}
NSInteger index = 0;
for (RDVTabBarItem *item in [[self tabBar] items])
{
item.titlePositionAdjustment = UIOffsetMake(0, 2.0);
[item setBackgroundSelectedImage:backgroundImage withUnselectedImage:backgroundImage];
UIImage *selectedimage = [UIImage imageNamed:[NSString stringWithFormat:@"%@_selected",[tabBarItemImages objectAtIndex:index]]];
UIImage *unselectedimage = [UIImage imageNamed:[NSString stringWithFormat:@"%@_normal",[tabBarItemImages objectAtIndex:index]]];
[item setFinishedSelectedImage:selectedimage withFinishedUnselectedImage:unselectedimage];
[item setTitle:[tabBarItemTitles objectAtIndex:index]];
item.selectedTitleAttributes = @{
NSFontAttributeName: [UIFont boldSystemFontOfSize:12],
NSForegroundColorAttributeName:kNAVIGATION_BAR_COLOR,
};
item.unselectedTitleAttributes = @{
NSFontAttributeName: [UIFont boldSystemFontOfSize:12],
NSForegroundColorAttributeName:RGB(217, 217, 217),
};
[item setTitle:[tabBarItemTitles objectAtIndex:index]];
index++;
}
}
기본적인 한 tabBar 빌드 좋은 그래서,하지만 여전히 우리는 각 표준 설정, 숨기기에 푸시 등등과 같은 몇 가지를 개선 할 필요가있다.
- 푸시 숨기기 한 tabBar 만 필요
- (void)viewWillAppear:(BOOL)animated{
[super viewWillAppear:animated];
[[self rdv_tabBarController] setTabBarHidden:YES animated:YES];
}
- 표준 각도의 수를 설정
[[self rdv_tabBarItem] setBadgeValue:@"3"];
- RDVTabBarControllerDelegate, 나는 ~ 좋은 방법 명명 중요 아, 당신은 모양을 이해 것으로 예상
/**
* Asks the delegate whether the specified view controller should be made active.
*/
- (BOOL)tabBarController:(RDVTabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController;
/**
* Tells the delegate that the user selected an item in the tab bar.
*/
* (void)tabBarController:(RDVTabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController;
발문
RDVTabBarController은 훌륭한 타사 tabBarController, 가치 학습과 생각입니다.
相比传统第三方,你会发现可以很好的定制角标,这是极好的,当然你也可以自定义;
但是不能定义中间凸起的tabBar,好早之前去哪儿就是中间凸起一个tabBar,不过现在去哪儿也改成传统的tabBar了;
-
더 토론을 참조하십시오 http://www.ios122.com/tag/rdvtabbarcontroller/