Skip to content

Commit 48356b7

Browse files
committed
Perfect Tab Bar
1 parent d6f2a55 commit 48356b7

File tree

6 files changed

+20
-25
lines changed

6 files changed

+20
-25
lines changed

MVVMReactiveCocoa/MRCAppDelegate.m

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ @implementation MRCAppDelegate
3636

3737
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
3838
[self configureFMDB];
39-
[self configureAppearance];
4039
[self configureKeyboardManager];
4140
[self configureReachability];
4241
[self configureUMengSocial];
@@ -52,6 +51,8 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
5251
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
5352
[self.services resetRootViewModel:[self createInitialViewModel]];
5453
[self.window makeKeyAndVisible];
54+
55+
[self configureAppearance];
5556

5657
// Save the application version info.
5758
[[NSUserDefaults standardUserDefaults] setValue:MRC_APP_VERSION forKey:MRCApplicationVersionKey];
@@ -108,7 +109,7 @@ - (void)configureFMDB {
108109
}
109110

110111
- (void)configureAppearance {
111-
self.window.backgroundColor = UIColor.whiteColor;
112+
self.window.backgroundColor = [UIColor whiteColor];
112113

113114
// 0x2F434F
114115
[UINavigationBar appearance].barTintColor = [UIColor colorWithRed:(48 - 40) / 215.0 green:(67 - 40) / 215.0 blue:(78 - 40) / 215.0 alpha:1];

MVVMReactiveCocoa/View/BaseClass/MRCTabBarController.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,9 @@
77
//
88

99
#import "MRCViewController.h"
10-
#import "WXTabBarController.h"
1110

1211
@interface MRCTabBarController : MRCViewController <UITabBarControllerDelegate>
1312

14-
@property (nonatomic, strong, readonly) WXTabBarController *tabBarController;
13+
@property (nonatomic, strong, readonly) UITabBarController *tabBarController;
1514

1615
@end

MVVMReactiveCocoa/View/BaseClass/MRCTabBarController.m

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@
77
//
88

99
#import "MRCTabBarController.h"
10+
#import "WXTabBarController.h"
1011

1112
@interface MRCTabBarController ()
1213

13-
@property (nonatomic, strong, readwrite) WXTabBarController *tabBarController;
14+
@property (nonatomic, strong, readwrite) UITabBarController *tabBarController;
1415

1516
@end
1617

@@ -38,12 +39,6 @@ - (UIStatusBarStyle)preferredStatusBarStyle {
3839
return self.tabBarController.preferredStatusBarStyle;
3940
}
4041

41-
#pragma mark - UITabBarControllerDelegate
42-
43-
- (UIInterfaceOrientationMask)tabBarControllerSupportedInterfaceOrientations:(UITabBarController *)tabBarController {
44-
return tabBarController.selectedViewController.supportedInterfaceOrientations;
45-
}
46-
4742
@end
4843

4944
@interface UITabBarController (MRCStatusBarAddtions)

MVVMReactiveCocoa/View/MRCHomepageViewController.m

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,6 @@ - (void)viewDidLoad {
121121
});
122122

123123
self.tabBarController.viewControllers = @[ newsNavigationController, reposNavigationController, searchNavigationController, profileNavigationController ];
124-
125-
self.tabBarController.delegate = self;
126124
}
127125

128126
@end

MVVMReactiveCocoa/View/TableHeaderFooterView/MRCAvatarHeaderView.m

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -118,17 +118,19 @@ - (void)bindViewModel:(MRCAvatarHeaderViewModel *)viewModel {
118118
}];
119119
}];
120120

121-
[[self.avatarButton rac_signalForControlEvents:UIControlEventTouchUpInside] subscribeNext:^(UIButton *avatarButton) {
122-
@strongify(self)
123-
MRCSharedAppDelegate.window.backgroundColor = [UIColor blackColor];
124-
125-
TGRImageViewController *viewController = [[TGRImageViewController alloc] initWithImage:[avatarButton imageForState:UIControlStateNormal]];
126-
127-
viewController.view.frame = CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
128-
viewController.transitioningDelegate = self;
129-
130-
[MRCSharedAppDelegate.window.rootViewController presentViewController:viewController animated:YES completion:NULL];
131-
}];
121+
[[self.avatarButton
122+
rac_signalForControlEvents:UIControlEventTouchUpInside]
123+
subscribeNext:^(UIButton *avatarButton) {
124+
@strongify(self)
125+
MRCSharedAppDelegate.window.backgroundColor = [UIColor blackColor];
126+
127+
TGRImageViewController *viewController = [[TGRImageViewController alloc] initWithImage:[avatarButton imageForState:UIControlStateNormal]];
128+
129+
viewController.view.frame = CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
130+
viewController.transitioningDelegate = self;
131+
132+
[MRCSharedAppDelegate.window.rootViewController presentViewController:viewController animated:YES completion:NULL];
133+
}];
132134

133135
RAC(self.nameLabel, text) = RACObserve(viewModel.user, login);
134136

0 commit comments

Comments
 (0)