接下来进入到登录后的第一个界面:
这几个界面应该是整个工程最核心最复杂的几个界面
首先整个tabBarController就是由:RDVTabBarController构建,至于使用非常简单就不多说,自己上github看吧!
这个RootTabViewController,由这句代码就能看出结构:
[self setViewControllers:@[nav_project, nav_mytask, nav_tweet, nav_message, nav_me]];
非常要注意的是这个,用RAC和badgeValue绑定:
Project_RootViewController *project = [[Project_RootViewController alloc] init];
RAC(project, rdv_tabBarItem.badgeValue) = [RACSignal combineLatest:@[RACObserve([UnReadManager shareManager], project_update_count)]
reduce:^id(NSNumber *project_update_count){
return project_update_count.integerValue > 0? kBadgeTipStr : @"";
}];
其中RACObserve就相当于KVO的作用
还有如何整合tabBarItems:
- (void)customizeTabBarForController {
UIImage *backgroundImage = [UIImage imageNamed:@"tabbar_background"];
NSArray *tabBarItemImages = @[@"project", @"task", @"tweet", @"privatemessage", @"me"];
NSArray *tabBarItemTitles = @[@"项目", @"任务", @"冒泡", @"消息", @"我"];
NSInteger index = 0;
for (RDVTabBarItem *item in [[self tabBar] items]) {
item.titlePositionAdjustment = UIOffsetMake(0, 3);
[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]];
index++;
}
}
接下来就一个个把这些重要界面剖析,主要结合viewController结构还有下面的几个功能实现:
1.Cell 的定制
2. 下拉刷新
3. 动画遮罩
4. 搜索
5. 动画菜单栏