Hannah Troisi 4e8d835280 [ASDKgram example update] addressed PR comments
- overrode the -(void)fetchData method in PhotoCellNode.m to download the photo’s comments. This method gets called with the PhotoCellNode enters ASInterfaceStateFetchData, which is set by the rangeController.
    - UIKIT COMPARISON: I left the comment bulk download (for all photos in a page load) in the PhotoFeedViewController side for UIKit because when implemented in the PhotoTableViewCell, each cell jumped around as it changed size when it came on screen.
- minor appearance updates
    - updated color scheme
    - fixed status bar style to darkBackgroundColor
- cleaned up layoutSpecThatFits: in PhotoCellNode
2016-04-14 00:52:05 -07:00

79 lines
3.4 KiB
Objective-C

//
// AppDelegate.m
// ASDKgram
//
// Created by Hannah Troisi on 2/16/16.
// Copyright © 2016 Hannah Troisi. All rights reserved.
//
#import "AppDelegate.h"
#import "PhotoFeedViewController.h"
#import "PhotoFeedNodeController.h"
#import "WindowWithStatusBarUnderlay.h"
#import "Utilities.h"
@interface AppDelegate () <UITabBarControllerDelegate>
@end
@implementation AppDelegate
{
WindowWithStatusBarUnderlay *_window;
}
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// this UIWindow subclass is neccessary to make the status bar opaque
_window = [[WindowWithStatusBarUnderlay alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
_window.backgroundColor = [UIColor whiteColor];
// UIKit Home Feed viewController & navController
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];
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];
tabBarController.selectedViewController = asdkHomeFeedNavCtrl;
tabBarController.delegate = self;
[[UITabBar appearance] setTintColor:[UIColor darkBlueColor]];
_window.rootViewController = tabBarController;
[_window makeKeyAndVisible];
// Nav Bar appearance
NSDictionary *attributes = @{NSForegroundColorAttributeName:[UIColor whiteColor]};
[[UINavigationBar appearance] setTitleTextAttributes:attributes];
[[UINavigationBar appearance] setBarTintColor:[UIColor darkBlueColor]];
[[UINavigationBar appearance] setTranslucent:NO];
// iOS8 hides the status bar in landscape orientation, this forces the status bar hidden status to NO
[application setStatusBarHidden:YES withAnimation:UIStatusBarAnimationNone];
[application setStatusBarHidden:NO withAnimation:UIStatusBarAnimationNone];
return YES;
}
#pragma mark - UITabBarControllerDelegate
- (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController
{
if ([viewController isKindOfClass:[UINavigationController class]]) {
NSArray *viewControllers = [(UINavigationController *)viewController viewControllers];
UIViewController *rootViewController = viewControllers[0];
if ([rootViewController conformsToProtocol:@protocol(PhotoFeedControllerProtocol)]) {
// FIXME: the dataModel does not currently handle clearing data during loading properly
// [(id <PhotoFeedControllerProtocol>)rootViewController resetAllData];
}
}
}
@end