mirror of
https://github.com/HackPlan/AsyncDisplayKit.git
synced 2026-04-29 04:05:35 +08:00
Move NavigationController and statusBarOpaqueUnderlayView to AppDelegate
This commit is contained in:
@@ -22,12 +22,14 @@
|
||||
PhotoFeedNodeController *asdkHomeFeedVC = [[PhotoFeedNodeController alloc] init];
|
||||
UINavigationController *asdkHomeFeedNavCtrl = [[UINavigationController alloc] initWithRootViewController:asdkHomeFeedVC];
|
||||
asdkHomeFeedNavCtrl.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"ASDK" image:[UIImage imageNamed:@"home"] tag:0];
|
||||
asdkHomeFeedNavCtrl.hidesBarsOnSwipe = YES;
|
||||
|
||||
// ASDK Home Feed viewController & navController
|
||||
PhotoFeedViewController *uikitHomeFeedVC = [[PhotoFeedViewController alloc] init];
|
||||
PhotoFeedViewController *uikitHomeFeedVC = [[PhotoFeedViewController alloc] init];
|
||||
UINavigationController *uikitHomeFeedNavCtrl = [[UINavigationController alloc] initWithRootViewController:uikitHomeFeedVC];
|
||||
uikitHomeFeedNavCtrl.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"UIKit" image:[UIImage imageNamed:@"home"] tag:0];
|
||||
|
||||
uikitHomeFeedNavCtrl.hidesBarsOnSwipe = YES;
|
||||
|
||||
// UITabBarController
|
||||
UITabBarController *tabBarController = [[UITabBarController alloc] init];
|
||||
tabBarController.viewControllers = @[uikitHomeFeedNavCtrl, asdkHomeFeedNavCtrl];
|
||||
@@ -44,9 +46,15 @@
|
||||
uikitHomeFeedNavCtrl.navigationBar.barStyle = UIBarStyleBlack;
|
||||
asdkHomeFeedNavCtrl.navigationBar.barStyle = UIBarStyleBlack;
|
||||
|
||||
self.window.rootViewController = tabBarController;
|
||||
self.window.rootViewController = tabBarController;
|
||||
[self.window makeKeyAndVisible];
|
||||
|
||||
// hack to make status bar opaque
|
||||
UIView *statusBarOpaqueUnderlayView = [[UIView alloc] init];
|
||||
statusBarOpaqueUnderlayView.backgroundColor = [UIColor darkBlueColor];
|
||||
statusBarOpaqueUnderlayView.frame = [[UIApplication sharedApplication] statusBarFrame];
|
||||
[[[UIApplication sharedApplication] keyWindow] addSubview:statusBarOpaqueUnderlayView];
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
|
||||
@@ -17,14 +17,11 @@
|
||||
#define DEBUG_PHOTOCELL_LAYOUT 0
|
||||
|
||||
#define HEADER_HEIGHT 50
|
||||
#define USER_IMAGE_HEIGHT 50
|
||||
#define USER_IMAGE_HEIGHT 30
|
||||
#define HORIZONTAL_BUFFER 10
|
||||
#define VERTICAL_BUFFER 5
|
||||
#define FONT_SIZE 14
|
||||
|
||||
@interface PhotoCellNode ()
|
||||
@end
|
||||
|
||||
@implementation PhotoCellNode
|
||||
{
|
||||
PhotoModel *_photoModel;
|
||||
|
||||
@@ -42,11 +42,6 @@
|
||||
|
||||
_tableNode.dataSource = self;
|
||||
_tableNode.delegate = self;
|
||||
|
||||
// hack to make status bar opaque
|
||||
_statusBarOpaqueUnderlayView = [[UIView alloc] init];
|
||||
_statusBarOpaqueUnderlayView.backgroundColor = [UIColor darkBlueColor];
|
||||
[[[UIApplication sharedApplication] keyWindow] addSubview:_statusBarOpaqueUnderlayView];
|
||||
}
|
||||
|
||||
return self;
|
||||
@@ -63,22 +58,6 @@
|
||||
|
||||
}
|
||||
|
||||
- (void)viewWillAppear:(BOOL)animated
|
||||
{
|
||||
[super viewWillAppear:animated];
|
||||
|
||||
// auto-hide navigation bar
|
||||
self.navigationController.hidesBarsOnSwipe = YES;
|
||||
}
|
||||
|
||||
- (void)viewWillLayoutSubviews
|
||||
{
|
||||
[super viewWillLayoutSubviews];
|
||||
|
||||
// hack to make status bar opaque view float over scroll
|
||||
_statusBarOpaqueUnderlayView.frame = [[UIApplication sharedApplication] statusBarFrame];
|
||||
}
|
||||
|
||||
#pragma mark - helper methods
|
||||
|
||||
- (void)refreshFeed
|
||||
|
||||
@@ -39,11 +39,6 @@
|
||||
_tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
|
||||
_tableView.delegate = self;
|
||||
_tableView.dataSource = self;
|
||||
|
||||
// hack to make status bar opaque
|
||||
_statusBarOpaqueUnderlayView = [[UIView alloc] init];
|
||||
_statusBarOpaqueUnderlayView.backgroundColor = [UIColor darkBlueColor];
|
||||
[[[UIApplication sharedApplication] keyWindow] addSubview:_statusBarOpaqueUnderlayView];
|
||||
}
|
||||
|
||||
return self;
|
||||
@@ -59,23 +54,6 @@
|
||||
_tableView.allowsSelection = NO;
|
||||
_tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
|
||||
[_tableView registerClass:[PhotoTableViewCell class] forCellReuseIdentifier:@"photoCell"];
|
||||
|
||||
}
|
||||
|
||||
- (void)viewWillAppear:(BOOL)animated
|
||||
{
|
||||
[super viewWillAppear:animated];
|
||||
|
||||
// auto-hide navigation bar
|
||||
self.navigationController.hidesBarsOnSwipe = YES;
|
||||
}
|
||||
|
||||
- (void)viewWillLayoutSubviews
|
||||
{
|
||||
[super viewWillLayoutSubviews];
|
||||
|
||||
// hack to make status bar opaque view float over scroll
|
||||
_statusBarOpaqueUnderlayView.frame = [[UIApplication sharedApplication] statusBarFrame];
|
||||
}
|
||||
|
||||
#pragma mark - helper methods
|
||||
|
||||
Reference in New Issue
Block a user