mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-16 11:20:18 +00:00
Switched ASDKViewController from UIViewController to ASViewController, renamed files.
This commit is contained in:
parent
d96582913a
commit
112bfa8e71
@ -42,42 +42,42 @@
|
|||||||
6C2C82AB19EE274300767484 /* Default-736h@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-736h@3x.png"; sourceTree = SOURCE_ROOT; };
|
6C2C82AB19EE274300767484 /* Default-736h@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-736h@3x.png"; sourceTree = SOURCE_ROOT; };
|
||||||
767A5F101CAA3BFE004CDA8D /* tabBarIcons */ = {isa = PBXFileReference; lastKnownFileType = folder; path = tabBarIcons; sourceTree = "<group>"; };
|
767A5F101CAA3BFE004CDA8D /* tabBarIcons */ = {isa = PBXFileReference; lastKnownFileType = folder; path = tabBarIcons; sourceTree = "<group>"; };
|
||||||
767A5F121CAA3C66004CDA8D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
|
767A5F121CAA3C66004CDA8D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
|
||||||
768843511CAA37EF00D8629E /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
|
768843511CAA37EF00D8629E /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = AppDelegate.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
|
||||||
768843521CAA37EF00D8629E /* CommentFeedModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CommentFeedModel.h; sourceTree = "<group>"; };
|
768843521CAA37EF00D8629E /* CommentFeedModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = CommentFeedModel.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
|
||||||
768843531CAA37EF00D8629E /* CommentModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CommentModel.h; sourceTree = "<group>"; };
|
768843531CAA37EF00D8629E /* CommentModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = CommentModel.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
|
||||||
768843541CAA37EF00D8629E /* CommentsNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CommentsNode.h; sourceTree = "<group>"; };
|
768843541CAA37EF00D8629E /* CommentsNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = CommentsNode.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
|
||||||
768843551CAA37EF00D8629E /* CommentView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CommentView.h; sourceTree = "<group>"; };
|
768843551CAA37EF00D8629E /* CommentView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = CommentView.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
|
||||||
768843561CAA37EF00D8629E /* ImageURLModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageURLModel.h; sourceTree = "<group>"; };
|
768843561CAA37EF00D8629E /* ImageURLModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = ImageURLModel.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
|
||||||
768843591CAA37EF00D8629E /* LocationModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LocationModel.h; sourceTree = "<group>"; };
|
768843591CAA37EF00D8629E /* LocationModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = LocationModel.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
|
||||||
7688435B1CAA37EF00D8629E /* PhotoCellNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PhotoCellNode.h; sourceTree = "<group>"; };
|
7688435B1CAA37EF00D8629E /* PhotoCellNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = PhotoCellNode.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
|
||||||
7688435C1CAA37EF00D8629E /* PhotoCollectionViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PhotoCollectionViewCell.h; sourceTree = "<group>"; };
|
7688435C1CAA37EF00D8629E /* PhotoCollectionViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = PhotoCollectionViewCell.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
|
||||||
7688435D1CAA37EF00D8629E /* PhotoFeedModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PhotoFeedModel.h; sourceTree = "<group>"; };
|
7688435D1CAA37EF00D8629E /* PhotoFeedModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = PhotoFeedModel.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
|
||||||
7688435E1CAA37EF00D8629E /* PhotoFeedNodeController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PhotoFeedNodeController.h; sourceTree = "<group>"; };
|
7688435E1CAA37EF00D8629E /* PhotoFeedNodeController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = PhotoFeedNodeController.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
|
||||||
768843601CAA37EF00D8629E /* PhotoModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PhotoModel.h; sourceTree = "<group>"; };
|
768843601CAA37EF00D8629E /* PhotoModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = PhotoModel.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
|
||||||
768843611CAA37EF00D8629E /* PhotoTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PhotoTableViewCell.h; sourceTree = "<group>"; };
|
768843611CAA37EF00D8629E /* PhotoTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = PhotoTableViewCell.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
|
||||||
768843621CAA37EF00D8629E /* PhotoTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PhotoTableViewController.h; sourceTree = "<group>"; };
|
768843621CAA37EF00D8629E /* PhotoTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = PhotoTableViewController.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
|
||||||
768843631CAA37EF00D8629E /* UserModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UserModel.h; sourceTree = "<group>"; };
|
768843631CAA37EF00D8629E /* UserModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = UserModel.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
|
||||||
768843651CAA37EF00D8629E /* UserRowView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UserRowView.h; sourceTree = "<group>"; };
|
768843651CAA37EF00D8629E /* UserRowView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = UserRowView.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
|
||||||
768843661CAA37EF00D8629E /* Utilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Utilities.h; sourceTree = "<group>"; };
|
768843661CAA37EF00D8629E /* Utilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = Utilities.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
|
||||||
768843671CAA37EF00D8629E /* Flickrgram.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Flickrgram.pch; sourceTree = "<group>"; };
|
768843671CAA37EF00D8629E /* Flickrgram.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = Flickrgram.pch; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objc; };
|
||||||
768843681CAA37EF00D8629E /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
|
768843681CAA37EF00D8629E /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = AppDelegate.m; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objc; };
|
||||||
768843691CAA37EF00D8629E /* CommentFeedModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CommentFeedModel.m; sourceTree = "<group>"; };
|
768843691CAA37EF00D8629E /* CommentFeedModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = CommentFeedModel.m; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objc; };
|
||||||
7688436A1CAA37EF00D8629E /* CommentModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CommentModel.m; sourceTree = "<group>"; };
|
7688436A1CAA37EF00D8629E /* CommentModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = CommentModel.m; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objc; };
|
||||||
7688436B1CAA37EF00D8629E /* CommentsNode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CommentsNode.m; sourceTree = "<group>"; };
|
7688436B1CAA37EF00D8629E /* CommentsNode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = CommentsNode.m; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objc; };
|
||||||
7688436C1CAA37EF00D8629E /* CommentView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CommentView.m; sourceTree = "<group>"; };
|
7688436C1CAA37EF00D8629E /* CommentView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = CommentView.m; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objc; };
|
||||||
7688436D1CAA37EF00D8629E /* ImageURLModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ImageURLModel.m; sourceTree = "<group>"; };
|
7688436D1CAA37EF00D8629E /* ImageURLModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = ImageURLModel.m; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objc; };
|
||||||
768843701CAA37EF00D8629E /* LocationModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LocationModel.m; sourceTree = "<group>"; };
|
768843701CAA37EF00D8629E /* LocationModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = LocationModel.m; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objc; };
|
||||||
768843711CAA37EF00D8629E /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
|
768843711CAA37EF00D8629E /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = main.m; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objc; };
|
||||||
768843731CAA37EF00D8629E /* PhotoCellNode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PhotoCellNode.m; sourceTree = "<group>"; };
|
768843731CAA37EF00D8629E /* PhotoCellNode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = PhotoCellNode.m; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objc; };
|
||||||
768843741CAA37EF00D8629E /* PhotoCollectionViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PhotoCollectionViewCell.m; sourceTree = "<group>"; };
|
768843741CAA37EF00D8629E /* PhotoCollectionViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = PhotoCollectionViewCell.m; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objc; };
|
||||||
768843751CAA37EF00D8629E /* PhotoFeedModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PhotoFeedModel.m; sourceTree = "<group>"; };
|
768843751CAA37EF00D8629E /* PhotoFeedModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = PhotoFeedModel.m; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objc; };
|
||||||
768843761CAA37EF00D8629E /* PhotoFeedNodeController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PhotoFeedNodeController.m; sourceTree = "<group>"; };
|
768843761CAA37EF00D8629E /* PhotoFeedNodeController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = PhotoFeedNodeController.m; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objc; };
|
||||||
768843781CAA37EF00D8629E /* PhotoModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PhotoModel.m; sourceTree = "<group>"; };
|
768843781CAA37EF00D8629E /* PhotoModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = PhotoModel.m; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objc; };
|
||||||
768843791CAA37EF00D8629E /* PhotoTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PhotoTableViewCell.m; sourceTree = "<group>"; };
|
768843791CAA37EF00D8629E /* PhotoTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = PhotoTableViewCell.m; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objc; };
|
||||||
7688437A1CAA37EF00D8629E /* PhotoTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PhotoTableViewController.m; sourceTree = "<group>"; };
|
7688437A1CAA37EF00D8629E /* PhotoTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = PhotoTableViewController.m; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objc; };
|
||||||
7688437B1CAA37EF00D8629E /* UserModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UserModel.m; sourceTree = "<group>"; };
|
7688437B1CAA37EF00D8629E /* UserModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = UserModel.m; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objc; };
|
||||||
7688437D1CAA37EF00D8629E /* UserRowView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UserRowView.m; sourceTree = "<group>"; };
|
7688437D1CAA37EF00D8629E /* UserRowView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = UserRowView.m; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objc; };
|
||||||
7688437E1CAA37EF00D8629E /* Utilities.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Utilities.m; sourceTree = "<group>"; };
|
7688437E1CAA37EF00D8629E /* Utilities.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = Utilities.m; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objc; };
|
||||||
7688437F1CAA37EF00D8629E /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
7688437F1CAA37EF00D8629E /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||||
C068F1D3F0CC317E895FCDAB /* Pods.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.debug.xcconfig; path = "Pods/Target Support Files/Pods/Pods.debug.xcconfig"; sourceTree = "<group>"; };
|
C068F1D3F0CC317E895FCDAB /* Pods.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.debug.xcconfig; path = "Pods/Target Support Files/Pods/Pods.debug.xcconfig"; sourceTree = "<group>"; };
|
||||||
/* End PBXFileReference section */
|
/* End PBXFileReference section */
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
//
|
//
|
||||||
// AppDelegate.h
|
// AppDelegate.h
|
||||||
// Flickrgram
|
// ASDKgram
|
||||||
//
|
//
|
||||||
// Created by Hannah Troisi on 2/16/16.
|
// Created by Hannah Troisi on 2/16/16.
|
||||||
// Copyright © 2016 Hannah Troisi. All rights reserved.
|
// Copyright © 2016 Hannah Troisi. All rights reserved.
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
//
|
//
|
||||||
// AppDelegate.m
|
// AppDelegate.m
|
||||||
// Flickrgram
|
// ASDKgram
|
||||||
//
|
//
|
||||||
// Created by Hannah Troisi on 2/16/16.
|
// Created by Hannah Troisi on 2/16/16.
|
||||||
// Copyright © 2016 Hannah Troisi. All rights reserved.
|
// Copyright © 2016 Hannah Troisi. All rights reserved.
|
||||||
@ -10,45 +10,42 @@
|
|||||||
#import "PhotoTableViewController.h"
|
#import "PhotoTableViewController.h"
|
||||||
#import "PhotoFeedNodeController.h"
|
#import "PhotoFeedNodeController.h"
|
||||||
#import "Utilities.h"
|
#import "Utilities.h"
|
||||||
#import "AsyncDisplayKit+Debug.h"
|
|
||||||
|
|
||||||
@implementation AppDelegate
|
@implementation AppDelegate
|
||||||
|
|
||||||
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
|
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
|
||||||
|
|
||||||
|
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
|
||||||
|
self.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];
|
||||||
|
|
||||||
|
// ASDK Home Feed viewController & navController
|
||||||
|
PhotoTableViewController *uikitHomeFeedVC = [[PhotoTableViewController alloc] init];
|
||||||
|
UINavigationController *uikitHomeFeedNavCtrl = [[UINavigationController alloc] initWithRootViewController:uikitHomeFeedVC];
|
||||||
|
uikitHomeFeedNavCtrl.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"UIKit" image:[UIImage imageNamed:@"home"] tag:0];
|
||||||
|
|
||||||
|
// UITabBarController
|
||||||
|
UITabBarController *tabBarController = [[UITabBarController alloc] init];
|
||||||
|
tabBarController.viewControllers = @[uikitHomeFeedNavCtrl, asdkHomeFeedNavCtrl];
|
||||||
|
tabBarController.selectedViewController = asdkHomeFeedNavCtrl;
|
||||||
|
|
||||||
// Nav Bar appearance
|
// Nav Bar appearance
|
||||||
[[UINavigationBar appearance] setBarTintColor:[UIColor darkBlueColor]];
|
[[UINavigationBar appearance] setBarTintColor:[UIColor darkBlueColor]];
|
||||||
[[UINavigationBar appearance] setTranslucent:NO];
|
[[UINavigationBar appearance] setTranslucent:NO];
|
||||||
NSDictionary *attributes = @{NSForegroundColorAttributeName:[UIColor whiteColor]};
|
NSDictionary *attributes = @{NSForegroundColorAttributeName:[UIColor whiteColor]};
|
||||||
[[UINavigationBar appearance] setTitleTextAttributes:attributes];
|
[[UINavigationBar appearance] setTitleTextAttributes:attributes];
|
||||||
|
// Hack to make the status bar have white text (changes after scrolling, but not on initial app startup)
|
||||||
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
|
|
||||||
self.window.backgroundColor = [UIColor whiteColor];
|
|
||||||
UITabBarController *tabBarController = [[UITabBarController alloc] init];
|
|
||||||
self.window.rootViewController = tabBarController;
|
|
||||||
[self.window makeKeyAndVisible];
|
|
||||||
|
|
||||||
// create UIKit-powered Home Feed viewController & navController
|
|
||||||
PhotoFeedNodeController *asdkPoweredHomeFeedVC = [[PhotoFeedNodeController alloc] init];
|
|
||||||
UINavigationController *asdkHomeFeedNavCtrl = [[UINavigationController alloc] initWithRootViewController:asdkPoweredHomeFeedVC];
|
|
||||||
asdkHomeFeedNavCtrl.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"ASDK" image:[UIImage imageNamed:@"home"] tag:0];
|
|
||||||
|
|
||||||
// create ASDK-powered Home Feed viewController & navController
|
|
||||||
PhotoTableViewController *uikitPoweredHomeFeedVC = [[PhotoTableViewController alloc] init];
|
|
||||||
UINavigationController *uikitHomeFeedNavCtrl = [[UINavigationController alloc] initWithRootViewController:uikitPoweredHomeFeedVC];
|
|
||||||
uikitHomeFeedNavCtrl.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"UIKit" image:[UIImage imageNamed:@"home"] tag:0];
|
|
||||||
|
|
||||||
// UINavigationController does not forward on preferredStatusBarStyle calls to its child view controllers.
|
// UINavigationController does not forward on preferredStatusBarStyle calls to its child view controllers.
|
||||||
// Instead it manages its own state...
|
// Instead it manages its own state...http://stackoverflow.com/questions/19022210/preferredstatusbarstyle-isnt-called/19513714#19513714
|
||||||
//http://stackoverflow.com/questions/19022210/preferredstatusbarstyle-isnt-called/19513714#19513714
|
|
||||||
uikitHomeFeedNavCtrl.navigationBar.barStyle = UIBarStyleBlack;
|
uikitHomeFeedNavCtrl.navigationBar.barStyle = UIBarStyleBlack;
|
||||||
asdkHomeFeedNavCtrl.navigationBar.barStyle = UIBarStyleBlack;
|
asdkHomeFeedNavCtrl.navigationBar.barStyle = UIBarStyleBlack;
|
||||||
|
|
||||||
// configure UITabBarController and add viewControllers
|
self.window.rootViewController = tabBarController;
|
||||||
tabBarController.viewControllers = @[uikitHomeFeedNavCtrl, asdkHomeFeedNavCtrl];
|
[self.window makeKeyAndVisible];
|
||||||
tabBarController.selectedViewController = asdkHomeFeedNavCtrl;
|
|
||||||
|
|
||||||
// [KMCGeigerCounter sharedGeigerCounter].enabled = YES;
|
|
||||||
|
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
//
|
//
|
||||||
// CommentFeedModel.h
|
// CommentFeedModel.h
|
||||||
// Flickrgram
|
// ASDKgram
|
||||||
//
|
//
|
||||||
// Created by Hannah Troisi on 3/9/16.
|
// Created by Hannah Troisi on 3/9/16.
|
||||||
// Copyright © 2016 Hannah Troisi. All rights reserved.
|
// Copyright © 2016 Hannah Troisi. All rights reserved.
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
//
|
//
|
||||||
// CommentFeedModel.m
|
// CommentFeedModel.m
|
||||||
// Flickrgram
|
// ASDKgram
|
||||||
//
|
//
|
||||||
// Created by Hannah Troisi on 3/9/16.
|
// Created by Hannah Troisi on 3/9/16.
|
||||||
// Copyright © 2016 Hannah Troisi. All rights reserved.
|
// Copyright © 2016 Hannah Troisi. All rights reserved.
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
//
|
//
|
||||||
// CommentModel.h
|
// CommentModel.h
|
||||||
// Flickrgram
|
// ASDKgram
|
||||||
//
|
//
|
||||||
// Created by Hannah Troisi on 3/9/16.
|
// Created by Hannah Troisi on 3/9/16.
|
||||||
// Copyright © 2016 Hannah Troisi. All rights reserved.
|
// Copyright © 2016 Hannah Troisi. All rights reserved.
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
//
|
//
|
||||||
// CommentModel.m
|
// CommentModel.m
|
||||||
// Flickrgram
|
// ASDKgram
|
||||||
//
|
//
|
||||||
// Created by Hannah Troisi on 3/9/16.
|
// Created by Hannah Troisi on 3/9/16.
|
||||||
// Copyright © 2016 Hannah Troisi. All rights reserved.
|
// Copyright © 2016 Hannah Troisi. All rights reserved.
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
//
|
//
|
||||||
// CommentView.h
|
// CommentView.h
|
||||||
// Flickrgram
|
// ASDKgram
|
||||||
//
|
//
|
||||||
// Created by Hannah Troisi on 3/9/16.
|
// Created by Hannah Troisi on 3/9/16.
|
||||||
// Copyright © 2016 Hannah Troisi. All rights reserved.
|
// Copyright © 2016 Hannah Troisi. All rights reserved.
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
//
|
//
|
||||||
// CommentView.m
|
// CommentView.m
|
||||||
// Flickrgram
|
// ASDKgram
|
||||||
//
|
//
|
||||||
// Created by Hannah Troisi on 3/9/16.
|
// Created by Hannah Troisi on 3/9/16.
|
||||||
// Copyright © 2016 Hannah Troisi. All rights reserved.
|
// Copyright © 2016 Hannah Troisi. All rights reserved.
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
//
|
//
|
||||||
// CommentsNode.h
|
// CommentsNode.h
|
||||||
// Flickrgram
|
// ASDKgram
|
||||||
//
|
//
|
||||||
// Created by Hannah Troisi on 3/21/16.
|
// Created by Hannah Troisi on 3/21/16.
|
||||||
// Copyright © 2016 Hannah Troisi. All rights reserved.
|
// Copyright © 2016 Hannah Troisi. All rights reserved.
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
//
|
//
|
||||||
// CommentsNode.m
|
// CommentsNode.m
|
||||||
// Flickrgram
|
// ASDKgram
|
||||||
//
|
//
|
||||||
// Created by Hannah Troisi on 3/21/16.
|
// Created by Hannah Troisi on 3/21/16.
|
||||||
// Copyright © 2016 Hannah Troisi. All rights reserved.
|
// Copyright © 2016 Hannah Troisi. All rights reserved.
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
//
|
//
|
||||||
// Flickrgram.pch
|
// ASDKgram.pch
|
||||||
// Flickrgram
|
// ASDKgram
|
||||||
//
|
//
|
||||||
// Created by Hannah Troisi on 2/26/16.
|
// Created by Hannah Troisi on 2/26/16.
|
||||||
// Copyright © 2016 Hannah Troisi. All rights reserved.
|
// Copyright © 2016 Hannah Troisi. All rights reserved.
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
//
|
//
|
||||||
// ImageURLModel.h
|
// ImageURLModel.h
|
||||||
// Flickrgram
|
// ASDKgram
|
||||||
//
|
//
|
||||||
// Created by Hannah Troisi on 3/11/16.
|
// Created by Hannah Troisi on 3/11/16.
|
||||||
// Copyright © 2016 Hannah Troisi. All rights reserved.
|
// Copyright © 2016 Hannah Troisi. All rights reserved.
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
//
|
//
|
||||||
// ImageURLModel.m
|
// ImageURLModel.m
|
||||||
// Flickrgram
|
// ASDKgram
|
||||||
//
|
//
|
||||||
// Created by Hannah Troisi on 3/11/16.
|
// Created by Hannah Troisi on 3/11/16.
|
||||||
// Copyright © 2016 Hannah Troisi. All rights reserved.
|
// Copyright © 2016 Hannah Troisi. All rights reserved.
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
//
|
//
|
||||||
// LocationModel.h
|
// LocationModel.h
|
||||||
// Flickrgram
|
// ASDKgram
|
||||||
//
|
//
|
||||||
// Created by Hannah Troisi on 2/26/16.
|
// Created by Hannah Troisi on 2/26/16.
|
||||||
// Copyright © 2016 Hannah Troisi. All rights reserved.
|
// Copyright © 2016 Hannah Troisi. All rights reserved.
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
//
|
//
|
||||||
// LocationModel.m
|
// LocationModel.m
|
||||||
// Flickrgram
|
// ASDKgram
|
||||||
//
|
//
|
||||||
// Created by Hannah Troisi on 2/26/16.
|
// Created by Hannah Troisi on 2/26/16.
|
||||||
// Copyright © 2016 Hannah Troisi. All rights reserved.
|
// Copyright © 2016 Hannah Troisi. All rights reserved.
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
//
|
//
|
||||||
// PhotoCellNode.h
|
// PhotoCellNode.h
|
||||||
// Flickrgram
|
// ASDKgram
|
||||||
//
|
//
|
||||||
// Created by Hannah Troisi on 2/17/16.
|
// Created by Hannah Troisi on 2/17/16.
|
||||||
// Copyright © 2016 Hannah Troisi. All rights reserved.
|
// Copyright © 2016 Hannah Troisi. All rights reserved.
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
//
|
//
|
||||||
// PhotoCellNode.m
|
// PhotoCellNode.m
|
||||||
// Flickrgram
|
// ASDKgram
|
||||||
//
|
//
|
||||||
// Created by Hannah Troisi on 2/17/16.
|
// Created by Hannah Troisi on 2/17/16.
|
||||||
// Copyright © 2016 Hannah Troisi. All rights reserved.
|
// Copyright © 2016 Hannah Troisi. All rights reserved.
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
//
|
//
|
||||||
// PhotoCollectionViewCell.h
|
// PhotoCollectionViewCell.h
|
||||||
// Flickrgram
|
// ASDKgram
|
||||||
//
|
//
|
||||||
// Created by Hannah Troisi on 3/2/16.
|
// Created by Hannah Troisi on 3/2/16.
|
||||||
// Copyright © 2016 Hannah Troisi. All rights reserved.
|
// Copyright © 2016 Hannah Troisi. All rights reserved.
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
//
|
//
|
||||||
// PhotoCollectionViewCell.m
|
// PhotoCollectionViewCell.m
|
||||||
// Flickrgram
|
// ASDKgram
|
||||||
//
|
//
|
||||||
// Created by Hannah Troisi on 3/2/16.
|
// Created by Hannah Troisi on 3/2/16.
|
||||||
// Copyright © 2016 Hannah Troisi. All rights reserved.
|
// Copyright © 2016 Hannah Troisi. All rights reserved.
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
//
|
//
|
||||||
// PhotoFeedModel.h
|
// PhotoFeedModel.h
|
||||||
// Flickrgram
|
// ASDKgram
|
||||||
//
|
//
|
||||||
// Created by Hannah Troisi on 2/28/16.
|
// Created by Hannah Troisi on 2/28/16.
|
||||||
// Copyright © 2016 Hannah Troisi. All rights reserved.
|
// Copyright © 2016 Hannah Troisi. All rights reserved.
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
//
|
//
|
||||||
// PhotoFeedModel.m
|
// PhotoFeedModel.m
|
||||||
// Flickrgram
|
// ASDKgram
|
||||||
//
|
//
|
||||||
// Created by Hannah Troisi on 2/28/16.
|
// Created by Hannah Troisi on 2/28/16.
|
||||||
// Copyright © 2016 Hannah Troisi. All rights reserved.
|
// Copyright © 2016 Hannah Troisi. All rights reserved.
|
||||||
|
|||||||
@ -1,14 +1,13 @@
|
|||||||
//
|
//
|
||||||
// PhotoFeedNodeController.h
|
// PhotoFeedNodeController.h
|
||||||
// Flickrgram
|
// ASDKgram
|
||||||
//
|
//
|
||||||
// Created by Hannah Troisi on 2/17/16.
|
// Created by Hannah Troisi on 2/17/16.
|
||||||
// Copyright © 2016 Hannah Troisi. All rights reserved.
|
// Copyright © 2016 Hannah Troisi. All rights reserved.
|
||||||
//
|
//
|
||||||
|
|
||||||
#import <UIKit/UIKit.h>
|
#import <AsyncDisplayKit/AsyncDisplayKit.h>
|
||||||
|
|
||||||
@interface PhotoFeedNodeController : UIViewController
|
|
||||||
|
|
||||||
|
@interface PhotoFeedNodeController : ASViewController
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
@ -1,18 +1,17 @@
|
|||||||
//
|
//
|
||||||
// PhotoFeedNodeController.m
|
// PhotoFeedNodeController.m
|
||||||
// Flickrgram
|
// ASDKgram
|
||||||
//
|
//
|
||||||
// Created by Hannah Troisi on 2/17/16.
|
// Created by Hannah Troisi on 2/17/16.
|
||||||
// Copyright © 2016 Hannah Troisi. All rights reserved.
|
// Copyright © 2016 Hannah Troisi. All rights reserved.
|
||||||
//
|
//
|
||||||
|
|
||||||
#import "PhotoFeedNodeController.h"
|
#import "PhotoFeedNodeController.h"
|
||||||
#import "PhotoModel.h"
|
|
||||||
#import "PhotoCellNode.h"
|
|
||||||
#import "PhotoTableViewCell.h"
|
|
||||||
#import "PhotoFeedModel.h"
|
|
||||||
#import <AsyncDisplayKit/AsyncDisplayKit.h>
|
#import <AsyncDisplayKit/AsyncDisplayKit.h>
|
||||||
#import "Utilities.h"
|
#import "Utilities.h"
|
||||||
|
#import "PhotoModel.h"
|
||||||
|
#import "PhotoCellNode.h"
|
||||||
|
#import "PhotoFeedModel.h"
|
||||||
|
|
||||||
#define AUTO_TAIL_LOADING_NUM_SCREENFULS 2.5
|
#define AUTO_TAIL_LOADING_NUM_SCREENFULS 2.5
|
||||||
|
|
||||||
@ -22,48 +21,124 @@
|
|||||||
@implementation PhotoFeedNodeController
|
@implementation PhotoFeedNodeController
|
||||||
{
|
{
|
||||||
PhotoFeedModel *_photoFeed;
|
PhotoFeedModel *_photoFeed;
|
||||||
ASTableView *_tableView;
|
ASTableNode *_tableNode;
|
||||||
UIView *_statusBarOpaqueUnderlayView;
|
UIView *_statusBarOpaqueUnderlayView;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#pragma mark - Lifecycle
|
#pragma mark - Lifecycle
|
||||||
|
|
||||||
- (instancetype)initWithNibName:(nullable NSString *)nibNameOrNil bundle:(nullable NSBundle *)nibBundleOrNil
|
- (instancetype)init
|
||||||
{
|
{
|
||||||
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
|
_tableNode = [[ASTableNode alloc] init];
|
||||||
|
self = [super initWithNode:_tableNode];
|
||||||
|
|
||||||
if (self) {
|
if (self) {
|
||||||
|
|
||||||
self.navigationItem.title = @"ASDK";
|
self.navigationItem.title = @"ASDK";
|
||||||
[self.navigationController setNavigationBarHidden:YES];
|
[self.navigationController setNavigationBarHidden:YES];
|
||||||
|
|
||||||
// _tableView.refreshControl = [[UIRefreshControl alloc] init];
|
_photoFeed = [[PhotoFeedModel alloc] initWithPhotoFeedModelType:PhotoFeedModelTypePopular
|
||||||
// [self.refreshControl addTarget:self action:@selector(refreshFeed) forControlEvents:UIControlEventValueChanged];
|
imageSize:[self imageSizeForScreenWidth]];
|
||||||
|
|
||||||
_photoFeed = [[PhotoFeedModel alloc] initWithPhotoFeedModelType:PhotoFeedModelTypePopular imageSize:[self imageSizeForScreenWidth]];
|
|
||||||
[self refreshFeed];
|
[self refreshFeed];
|
||||||
|
|
||||||
|
_tableNode.dataSource = self;
|
||||||
|
_tableNode.delegate = self;
|
||||||
|
|
||||||
|
// hack to make status bar opaque
|
||||||
_statusBarOpaqueUnderlayView = [[UIView alloc] init];
|
_statusBarOpaqueUnderlayView = [[UIView alloc] init];
|
||||||
_statusBarOpaqueUnderlayView.backgroundColor = [UIColor darkBlueColor];
|
_statusBarOpaqueUnderlayView.backgroundColor = [UIColor darkBlueColor];
|
||||||
[[[UIApplication sharedApplication] keyWindow] addSubview:_statusBarOpaqueUnderlayView];
|
[[[UIApplication sharedApplication] keyWindow] addSubview:_statusBarOpaqueUnderlayView];
|
||||||
|
|
||||||
|
|
||||||
// ASTABLEVIEW
|
|
||||||
_tableView = [[ASTableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain asyncDataFetching:YES];
|
|
||||||
_tableView.asyncDataSource = self;
|
|
||||||
_tableView.asyncDelegate = self;
|
|
||||||
_tableView.allowsSelection = NO;
|
|
||||||
_tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
|
|
||||||
|
|
||||||
// enable tableView pull-to-refresh & add target-action pair
|
|
||||||
// self.refreshControl = [[UIRefreshControl alloc] init];
|
|
||||||
// [self.refreshControl addTarget:self action:@selector(refreshFeed) forControlEvents:UIControlEventValueChanged];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// do any ASDK view stuff in loadView
|
||||||
|
- (void)loadView
|
||||||
|
{
|
||||||
|
[super loadView];
|
||||||
|
|
||||||
|
self.view.backgroundColor = [UIColor whiteColor];
|
||||||
|
_tableNode.view.allowsSelection = NO;
|
||||||
|
_tableNode.view.separatorStyle = UITableViewCellSeparatorStyleNone;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
- (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
|
||||||
|
{
|
||||||
|
// small first batch
|
||||||
|
[_photoFeed refreshFeedWithCompletionBlock:^(NSArray *newPhotos){
|
||||||
|
|
||||||
|
[self insertNewRowsInTableView:newPhotos];
|
||||||
|
[self requestCommentsForPhotos:newPhotos];
|
||||||
|
|
||||||
|
// immediately start second larger fetch
|
||||||
|
[self loadPage];
|
||||||
|
|
||||||
|
} numResultsToReturn:4];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)loadPage
|
||||||
|
{
|
||||||
|
[_photoFeed requestPageWithCompletionBlock:^(NSArray *newPhotos){
|
||||||
|
[self insertNewRowsInTableView:newPhotos];
|
||||||
|
[self requestCommentsForPhotos:newPhotos];
|
||||||
|
} numResultsToReturn:20];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)requestCommentsForPhotos:(NSArray *)newPhotos
|
||||||
|
{
|
||||||
|
for (PhotoModel *photo in newPhotos) {
|
||||||
|
[photo.commentFeed refreshFeedWithCompletionBlock:^(NSArray *newComments) {
|
||||||
|
|
||||||
|
NSInteger rowNum = [_photoFeed indexOfPhotoModel:photo];
|
||||||
|
PhotoCellNode *cell = (PhotoCellNode *)[_tableNode.view nodeForRowAtIndexPath:[NSIndexPath indexPathForRow:rowNum inSection:0]];
|
||||||
|
|
||||||
|
if (cell) {
|
||||||
|
[cell loadCommentsForPhoto:photo];
|
||||||
|
[_tableNode.view beginUpdates];
|
||||||
|
[_tableNode.view endUpdates];
|
||||||
|
}
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)insertNewRowsInTableView:(NSArray *)newPhotos
|
||||||
|
{
|
||||||
|
NSInteger section = 0;
|
||||||
|
NSMutableArray *indexPaths = [NSMutableArray array];
|
||||||
|
|
||||||
|
NSUInteger newTotalNumberOfPhotos = [_photoFeed numberOfItemsInFeed];
|
||||||
|
for (NSUInteger row = newTotalNumberOfPhotos - newPhotos.count; row < newTotalNumberOfPhotos; row++) {
|
||||||
|
NSIndexPath *path = [NSIndexPath indexPathForRow:row inSection:section];
|
||||||
|
[indexPaths addObject:path];
|
||||||
|
}
|
||||||
|
|
||||||
|
[_tableNode.view insertRowsAtIndexPaths:indexPaths withRowAnimation:UITableViewRowAnimationNone];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (UIStatusBarStyle)preferredStatusBarStyle
|
||||||
|
{
|
||||||
|
return UIStatusBarStyleLightContent;
|
||||||
|
}
|
||||||
|
|
||||||
- (CGSize)imageSizeForScreenWidth
|
- (CGSize)imageSizeForScreenWidth
|
||||||
{
|
{
|
||||||
CGRect screenRect = [[UIScreen mainScreen] bounds];
|
CGRect screenRect = [[UIScreen mainScreen] bounds];
|
||||||
@ -71,135 +146,7 @@
|
|||||||
return CGSizeMake(screenRect.size.width * screenScale, screenRect.size.width * screenScale);
|
return CGSizeMake(screenRect.size.width * screenScale, screenRect.size.width * screenScale);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)loadView
|
#pragma mark - ASTableDataSource methods
|
||||||
{
|
|
||||||
[super loadView];
|
|
||||||
|
|
||||||
[self.view addSubview:_tableView]; //FIXME: self use implicit heirarchy?
|
|
||||||
self.view.backgroundColor = [UIColor whiteColor]; //ditto
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)viewWillAppear:(BOOL)animated
|
|
||||||
{
|
|
||||||
[super viewWillAppear:animated];
|
|
||||||
|
|
||||||
self.navigationController.hidesBarsOnSwipe = YES;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)viewWillLayoutSubviews
|
|
||||||
{
|
|
||||||
[super viewWillLayoutSubviews];
|
|
||||||
|
|
||||||
_tableView.frame = self.view.bounds;
|
|
||||||
_statusBarOpaqueUnderlayView.frame = [[UIApplication sharedApplication] statusBarFrame];
|
|
||||||
}
|
|
||||||
|
|
||||||
#pragma mark - Gesture Handling
|
|
||||||
|
|
||||||
- (void)refreshFeed
|
|
||||||
{
|
|
||||||
// small first batch
|
|
||||||
[_photoFeed refreshFeedWithCompletionBlock:^(NSArray *newPhotos){
|
|
||||||
|
|
||||||
[_tableView reloadData]; // overwrite tableView instead of inserting new rows
|
|
||||||
// [self.refreshControl endRefreshing];
|
|
||||||
[self requestCommentsForPhotos:newPhotos];
|
|
||||||
|
|
||||||
// immediately start second larger fetch
|
|
||||||
[self loadPage];
|
|
||||||
|
|
||||||
} numResultsToReturn:4];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (UIStatusBarStyle)preferredStatusBarStyle // FIXME - doesn't work?
|
|
||||||
{
|
|
||||||
return UIStatusBarStyleLightContent;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)loadPage
|
|
||||||
{
|
|
||||||
// NSLog(@"_photoFeed number of items = %lu", [_photoFeed numberOfItemsInFeed]);
|
|
||||||
|
|
||||||
[self logPhotoIDsInPhotoFeed];
|
|
||||||
|
|
||||||
[_photoFeed requestPageWithCompletionBlock:^(NSArray *newPhotos){
|
|
||||||
|
|
||||||
[self insertNewRowsInTableView:newPhotos];
|
|
||||||
[self requestCommentsForPhotos:newPhotos];
|
|
||||||
[self logPhotoIDsInPhotoFeed];
|
|
||||||
|
|
||||||
} numResultsToReturn:20];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)requestCommentsForPhotos:(NSArray *)newPhotos
|
|
||||||
{
|
|
||||||
for (PhotoModel *photo in newPhotos) {
|
|
||||||
|
|
||||||
[photo.commentFeed refreshFeedWithCompletionBlock:^(NSArray *newComments) {
|
|
||||||
|
|
||||||
NSInteger rowNum = [_photoFeed indexOfPhotoModel:photo];
|
|
||||||
PhotoCellNode *cell = (PhotoCellNode *)[_tableView nodeForRowAtIndexPath:[NSIndexPath indexPathForRow:rowNum inSection:0]];
|
|
||||||
|
|
||||||
if (cell) {
|
|
||||||
[cell loadCommentsForPhoto:photo];
|
|
||||||
[_tableView beginUpdates];
|
|
||||||
[_tableView endUpdates];
|
|
||||||
}
|
|
||||||
}];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)logPhotoIDsInPhotoFeed
|
|
||||||
{
|
|
||||||
// NSLog(@"_photoFeed number of items = %lu", [_photoFeed numberOfItemsInFeed]);
|
|
||||||
|
|
||||||
// for (int i = 0; i < [_photoFeed numberOfItemsInFeed]; i++) {
|
|
||||||
// if (i % 4 == 0 && i > 0) {
|
|
||||||
// NSLog(@"\t-----");
|
|
||||||
// }
|
|
||||||
|
|
||||||
// [_photoFeed return]
|
|
||||||
// NSString *duplicate = ? @"(DUPLICATE)" : @"";
|
|
||||||
// NSLog(@"\t%@ %@", [[_photoFeed objectAtIndex:i] photoID], @"");
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)insertNewRowsInTableView:(NSArray *)newPhotos
|
|
||||||
{
|
|
||||||
// NSLog(@"_photoFeed number of items = %lu (%lu total)", (unsigned long)[_photoFeed numberOfItemsInFeed], (long)[_photoFeed totalNumberOfPhotos]);
|
|
||||||
|
|
||||||
// instead of doing tableView reloadData, use table editing commands
|
|
||||||
NSMutableArray *indexPaths = [NSMutableArray array];
|
|
||||||
|
|
||||||
NSInteger section = 0;
|
|
||||||
NSUInteger newTotalNumberOfPhotos = [_photoFeed numberOfItemsInFeed];
|
|
||||||
for (NSUInteger row = newTotalNumberOfPhotos - newPhotos.count; row < newTotalNumberOfPhotos; row++) {
|
|
||||||
|
|
||||||
NSIndexPath *path = [NSIndexPath indexPathForRow:row inSection:section];
|
|
||||||
[indexPaths addObject:path];
|
|
||||||
}
|
|
||||||
|
|
||||||
[_tableView insertRowsAtIndexPaths:indexPaths withRowAnimation:UITableViewRowAnimationNone];
|
|
||||||
}
|
|
||||||
|
|
||||||
#pragma mark - ASTableDelegate protocol methods
|
|
||||||
-(void)scrollViewDidScroll:(UIScrollView *)scrollView
|
|
||||||
{
|
|
||||||
|
|
||||||
CGFloat currentOffSetY = scrollView.contentOffset.y;
|
|
||||||
CGFloat contentHeight = scrollView.contentSize.height;
|
|
||||||
CGFloat screenHeight = [UIScreen mainScreen].bounds.size.height;
|
|
||||||
|
|
||||||
// automatic tail loading
|
|
||||||
CGFloat screenfullsBeforeBottom = (contentHeight - currentOffSetY) / screenHeight;
|
|
||||||
if (screenfullsBeforeBottom < AUTO_TAIL_LOADING_NUM_SCREENFULS) {
|
|
||||||
// NSLog(@"AUTOMATIC TAIL LOADING BEGIN");
|
|
||||||
[self loadPage];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#pragma mark - ASTableDataSource protocol methods
|
|
||||||
|
|
||||||
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
|
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
|
||||||
{
|
{
|
||||||
@ -208,9 +155,24 @@
|
|||||||
|
|
||||||
- (ASCellNode *)tableView:(ASTableView *)tableView nodeForRowAtIndexPath:(NSIndexPath *)indexPath;
|
- (ASCellNode *)tableView:(ASTableView *)tableView nodeForRowAtIndexPath:(NSIndexPath *)indexPath;
|
||||||
{
|
{
|
||||||
PhotoCellNode *cell = [[PhotoCellNode alloc] initWithPhotoObject:[_photoFeed objectAtIndex:indexPath.row]];
|
PhotoCellNode *cellNode = [[PhotoCellNode alloc] initWithPhotoObject:[_photoFeed objectAtIndex:indexPath.row]];
|
||||||
|
|
||||||
return cell;
|
return cellNode;
|
||||||
|
}
|
||||||
|
|
||||||
|
#pragma mark - ASTableDelegate methods
|
||||||
|
|
||||||
|
// table automatic tail loading
|
||||||
|
-(void)scrollViewDidScroll:(UIScrollView *)scrollView
|
||||||
|
{
|
||||||
|
CGFloat currentOffSetY = scrollView.contentOffset.y;
|
||||||
|
CGFloat contentHeight = scrollView.contentSize.height;
|
||||||
|
CGFloat screenHeight = [UIScreen mainScreen].bounds.size.height;
|
||||||
|
|
||||||
|
CGFloat screenfullsBeforeBottom = (contentHeight - currentOffSetY) / screenHeight;
|
||||||
|
if (screenfullsBeforeBottom < AUTO_TAIL_LOADING_NUM_SCREENFULS) {
|
||||||
|
[self loadPage];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
//
|
//
|
||||||
// PhotoModel.h
|
// PhotoModel.h
|
||||||
// Flickrgram
|
// ASDKgram
|
||||||
//
|
//
|
||||||
// Created by Hannah Troisi on 2/26/16.
|
// Created by Hannah Troisi on 2/26/16.
|
||||||
// Copyright © 2016 Hannah Troisi. All rights reserved.
|
// Copyright © 2016 Hannah Troisi. All rights reserved.
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
//
|
//
|
||||||
// PhotoModel.m
|
// PhotoModel.m
|
||||||
// Flickrgram
|
// ASDKgram
|
||||||
//
|
//
|
||||||
// Created by Hannah Troisi on 2/26/16.
|
// Created by Hannah Troisi on 2/26/16.
|
||||||
// Copyright © 2016 Hannah Troisi. All rights reserved.
|
// Copyright © 2016 Hannah Troisi. All rights reserved.
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
//
|
//
|
||||||
// PhotoTableViewCell.h
|
// PhotoTableViewCell.h
|
||||||
// Flickrgram
|
// ASDKgram
|
||||||
//
|
//
|
||||||
// Created by Hannah Troisi on 2/17/16.
|
// Created by Hannah Troisi on 2/17/16.
|
||||||
// Copyright © 2016 Hannah Troisi. All rights reserved.
|
// Copyright © 2016 Hannah Troisi. All rights reserved.
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
//
|
//
|
||||||
// PhotoTableViewCell.m
|
// PhotoTableViewCell.m
|
||||||
// Flickrgram
|
// ASDKgram
|
||||||
//
|
//
|
||||||
// Created by Hannah Troisi on 2/17/16.
|
// Created by Hannah Troisi on 2/17/16.
|
||||||
// Copyright © 2016 Hannah Troisi. All rights reserved.
|
// Copyright © 2016 Hannah Troisi. All rights reserved.
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
//
|
//
|
||||||
// PhotoTableViewController.h
|
// PhotoTableViewController.h
|
||||||
// Flickrgram
|
// ASDKgram
|
||||||
//
|
//
|
||||||
// Created by Hannah Troisi on 2/17/16.
|
// Created by Hannah Troisi on 2/17/16.
|
||||||
// Copyright © 2016 Hannah Troisi. All rights reserved.
|
// Copyright © 2016 Hannah Troisi. All rights reserved.
|
||||||
|
|||||||
@ -1,27 +1,24 @@
|
|||||||
//
|
//
|
||||||
// PhotoTableViewController.m
|
// PhotoTableViewController.m
|
||||||
// Flickrgram
|
// ASDKgram
|
||||||
//
|
//
|
||||||
// Created by Hannah Troisi on 2/17/16.
|
// Created by Hannah Troisi on 2/17/16.
|
||||||
// Copyright © 2016 Hannah Troisi. All rights reserved.
|
// Copyright © 2016 Hannah Troisi. All rights reserved.
|
||||||
//
|
//
|
||||||
|
|
||||||
#import "PhotoTableViewController.h"
|
#import "PhotoTableViewController.h"
|
||||||
|
#import "Utilities.h"
|
||||||
#import "PhotoTableViewCell.h"
|
#import "PhotoTableViewCell.h"
|
||||||
#import "PhotoFeedModel.h"
|
#import "PhotoFeedModel.h"
|
||||||
#import "Utilities.h"
|
|
||||||
|
|
||||||
|
|
||||||
#define AUTO_TAIL_LOADING_NUM_SCREENFULS 2.5
|
#define AUTO_TAIL_LOADING_NUM_SCREENFULS 2.5
|
||||||
|
|
||||||
|
|
||||||
@implementation PhotoTableViewController
|
@implementation PhotoTableViewController
|
||||||
{
|
{
|
||||||
PhotoFeedModel *_photoFeed;
|
PhotoFeedModel *_photoFeed;
|
||||||
UIView *_statusBarOpaqueUnderlayView;
|
UIView *_statusBarOpaqueUnderlayView;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#pragma mark - Lifecycle
|
#pragma mark - Lifecycle
|
||||||
|
|
||||||
- (instancetype)initWithStyle:(UITableViewStyle)style
|
- (instancetype)initWithStyle:(UITableViewStyle)style
|
||||||
@ -33,12 +30,13 @@
|
|||||||
self.navigationItem.title = @"UIKit";
|
self.navigationItem.title = @"UIKit";
|
||||||
[self.navigationController setNavigationBarHidden:YES];
|
[self.navigationController setNavigationBarHidden:YES];
|
||||||
|
|
||||||
self.refreshControl = [[UIRefreshControl alloc] init];
|
|
||||||
[self.refreshControl addTarget:self action:@selector(refreshFeed) forControlEvents:UIControlEventValueChanged];
|
|
||||||
|
|
||||||
_photoFeed = [[PhotoFeedModel alloc] initWithPhotoFeedModelType:PhotoFeedModelTypePopular imageSize:[self imageSizeForScreenWidth]];
|
_photoFeed = [[PhotoFeedModel alloc] initWithPhotoFeedModelType:PhotoFeedModelTypePopular imageSize:[self imageSizeForScreenWidth]];
|
||||||
[self refreshFeed];
|
[self refreshFeed];
|
||||||
|
|
||||||
|
self.refreshControl = [[UIRefreshControl alloc] init];
|
||||||
|
[self.refreshControl addTarget:self action:@selector(refreshFeed) forControlEvents:UIControlEventValueChanged];
|
||||||
|
|
||||||
|
// hack to make status bar opaque
|
||||||
_statusBarOpaqueUnderlayView = [[UIView alloc] init];
|
_statusBarOpaqueUnderlayView = [[UIView alloc] init];
|
||||||
_statusBarOpaqueUnderlayView.backgroundColor = [UIColor darkBlueColor];
|
_statusBarOpaqueUnderlayView.backgroundColor = [UIColor darkBlueColor];
|
||||||
[[[UIApplication sharedApplication] keyWindow] addSubview:_statusBarOpaqueUnderlayView];
|
[[[UIApplication sharedApplication] keyWindow] addSubview:_statusBarOpaqueUnderlayView];
|
||||||
@ -47,7 +45,8 @@
|
|||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)viewDidLoad // anything involving the view should go here, not init
|
// anything involving the view should go here, not init
|
||||||
|
- (void)viewDidLoad
|
||||||
{
|
{
|
||||||
[super viewDidLoad];
|
[super viewDidLoad];
|
||||||
|
|
||||||
@ -61,6 +60,7 @@
|
|||||||
{
|
{
|
||||||
[super viewWillAppear:animated];
|
[super viewWillAppear:animated];
|
||||||
|
|
||||||
|
// auto-hide navigation bar
|
||||||
self.navigationController.hidesBarsOnSwipe = YES;
|
self.navigationController.hidesBarsOnSwipe = YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,18 +68,18 @@
|
|||||||
{
|
{
|
||||||
[super viewWillLayoutSubviews];
|
[super viewWillLayoutSubviews];
|
||||||
|
|
||||||
|
// hack to make status bar opaque view float over scroll
|
||||||
_statusBarOpaqueUnderlayView.frame = [[UIApplication sharedApplication] statusBarFrame];
|
_statusBarOpaqueUnderlayView.frame = [[UIApplication sharedApplication] statusBarFrame];
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - Instance Methods
|
#pragma mark - helper methods
|
||||||
|
|
||||||
- (void)refreshFeed
|
- (void)refreshFeed
|
||||||
{
|
{
|
||||||
// small first batch
|
// small first batch
|
||||||
[_photoFeed refreshFeedWithCompletionBlock:^(NSArray *newPhotos){
|
[_photoFeed refreshFeedWithCompletionBlock:^(NSArray *newPhotos){
|
||||||
|
|
||||||
[self.tableView reloadData]; // overwrite tableView instead of inserting new rows
|
[self insertNewRowsInTableView:newPhotos];
|
||||||
[self.refreshControl endRefreshing];
|
|
||||||
[self requestCommentsForPhotos:newPhotos];
|
[self requestCommentsForPhotos:newPhotos];
|
||||||
|
|
||||||
// immediately start second larger fetch
|
// immediately start second larger fetch
|
||||||
@ -88,13 +88,6 @@
|
|||||||
} numResultsToReturn:4];
|
} numResultsToReturn:4];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (UIStatusBarStyle)preferredStatusBarStyle
|
|
||||||
{
|
|
||||||
return UIStatusBarStyleLightContent;
|
|
||||||
}
|
|
||||||
|
|
||||||
#pragma mark - Helper Methods
|
|
||||||
|
|
||||||
- (void)loadPage
|
- (void)loadPage
|
||||||
{
|
{
|
||||||
[_photoFeed requestPageWithCompletionBlock:^(NSArray *newPhotos){
|
[_photoFeed requestPageWithCompletionBlock:^(NSArray *newPhotos){
|
||||||
@ -106,7 +99,6 @@
|
|||||||
- (void)requestCommentsForPhotos:(NSArray *)newPhotos
|
- (void)requestCommentsForPhotos:(NSArray *)newPhotos
|
||||||
{
|
{
|
||||||
for (PhotoModel *photo in newPhotos) {
|
for (PhotoModel *photo in newPhotos) {
|
||||||
|
|
||||||
[photo.commentFeed refreshFeedWithCompletionBlock:^(NSArray *newComments) {
|
[photo.commentFeed refreshFeedWithCompletionBlock:^(NSArray *newComments) {
|
||||||
|
|
||||||
NSInteger rowNum = [_photoFeed indexOfPhotoModel:photo];
|
NSInteger rowNum = [_photoFeed indexOfPhotoModel:photo];
|
||||||
@ -116,12 +108,30 @@
|
|||||||
[cell loadCommentsForPhoto:photo];
|
[cell loadCommentsForPhoto:photo];
|
||||||
[self.tableView beginUpdates];
|
[self.tableView beginUpdates];
|
||||||
[self.tableView endUpdates];
|
[self.tableView endUpdates];
|
||||||
// FIXME: adjust content offset - iterate over cells above to get heights...
|
|
||||||
}
|
}
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)insertNewRowsInTableView:(NSArray *)newPhotos
|
||||||
|
{
|
||||||
|
NSInteger section = 0;
|
||||||
|
NSMutableArray *indexPaths = [NSMutableArray array];
|
||||||
|
|
||||||
|
NSUInteger newTotalNumberOfPhotos = [_photoFeed numberOfItemsInFeed];
|
||||||
|
for (NSUInteger row = newTotalNumberOfPhotos - newPhotos.count; row < newTotalNumberOfPhotos; row++) {
|
||||||
|
NSIndexPath *path = [NSIndexPath indexPathForRow:row inSection:section];
|
||||||
|
[indexPaths addObject:path];
|
||||||
|
}
|
||||||
|
|
||||||
|
[self.tableView insertRowsAtIndexPaths:indexPaths withRowAnimation:UITableViewRowAnimationNone];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (UIStatusBarStyle)preferredStatusBarStyle
|
||||||
|
{
|
||||||
|
return UIStatusBarStyleLightContent;
|
||||||
|
}
|
||||||
|
|
||||||
- (CGSize)imageSizeForScreenWidth
|
- (CGSize)imageSizeForScreenWidth
|
||||||
{
|
{
|
||||||
CGRect screenRect = [[UIScreen mainScreen] bounds];
|
CGRect screenRect = [[UIScreen mainScreen] bounds];
|
||||||
@ -129,58 +139,7 @@
|
|||||||
return CGSizeMake(screenRect.size.width * screenScale, screenRect.size.width * screenScale);
|
return CGSizeMake(screenRect.size.width * screenScale, screenRect.size.width * screenScale);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)insertNewRowsInTableView:(NSArray *)newPhotos
|
#pragma mark - UITableViewDataSource methods
|
||||||
{
|
|
||||||
// NSLog(@"_photoFeed number of items = %lu (%lu total)", (unsigned long)[_photoFeed numberOfItemsInFeed], (long)[_photoFeed totalNumberOfPhotos]);
|
|
||||||
|
|
||||||
// instead of doing tableView reloadData, use table editing commands
|
|
||||||
NSMutableArray *indexPaths = [NSMutableArray array];
|
|
||||||
|
|
||||||
NSInteger section = 0;
|
|
||||||
NSUInteger newTotalNumberOfPhotos = [_photoFeed numberOfItemsInFeed];
|
|
||||||
for (NSUInteger row = newTotalNumberOfPhotos - newPhotos.count; row < newTotalNumberOfPhotos; row++) {
|
|
||||||
|
|
||||||
NSIndexPath *path = [NSIndexPath indexPathForRow:row inSection:section];
|
|
||||||
[indexPaths addObject:path];
|
|
||||||
}
|
|
||||||
|
|
||||||
[self.tableView insertRowsAtIndexPaths:indexPaths withRowAnimation:UITableViewRowAnimationNone];
|
|
||||||
}
|
|
||||||
|
|
||||||
//- (void)logPhotoIDsInPhotoFeed
|
|
||||||
//{
|
|
||||||
// NSLog(@"_photoFeed number of items = %lu", (unsigned long)[_photoFeed numberOfItemsInFeed]);
|
|
||||||
//
|
|
||||||
// for (int i = 0; i < [_photoFeed numberOfItemsInFeed]; i++) {
|
|
||||||
// if (i % 4 == 0 && i > 0) {
|
|
||||||
// NSLog(@"\t-----");
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
//// [_photoFeed return]
|
|
||||||
//// NSString *duplicate = ? @"(DUPLICATE)" : @"";
|
|
||||||
// NSLog(@"\t%@ %@", [[_photoFeed objectAtIndex:i] photoID], @"");
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
|
|
||||||
#pragma mark - UITableViewDelegate
|
|
||||||
|
|
||||||
-(void)scrollViewDidScroll:(UIScrollView *)scrollView
|
|
||||||
{
|
|
||||||
|
|
||||||
CGFloat currentOffSetY = scrollView.contentOffset.y;
|
|
||||||
CGFloat contentHeight = scrollView.contentSize.height;
|
|
||||||
CGFloat screenHeight = [UIScreen mainScreen].bounds.size.height;
|
|
||||||
|
|
||||||
// automatic tail loading
|
|
||||||
CGFloat screenfullsBeforeBottom = (contentHeight - currentOffSetY) / screenHeight;
|
|
||||||
if (screenfullsBeforeBottom < AUTO_TAIL_LOADING_NUM_SCREENFULS) {
|
|
||||||
// NSLog(@"AUTOMATIC TAIL LOADING BEGIN");
|
|
||||||
[self loadPage];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#pragma mark - UITableViewDataSource
|
|
||||||
|
|
||||||
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
|
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
|
||||||
{
|
{
|
||||||
@ -190,7 +149,6 @@
|
|||||||
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
|
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
|
||||||
{
|
{
|
||||||
PhotoTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"photoCell" forIndexPath:indexPath];
|
PhotoTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"photoCell" forIndexPath:indexPath];
|
||||||
|
|
||||||
[cell updateCellWithPhotoObject:[_photoFeed objectAtIndex:indexPath.row]];
|
[cell updateCellWithPhotoObject:[_photoFeed objectAtIndex:indexPath.row]];
|
||||||
|
|
||||||
return cell;
|
return cell;
|
||||||
@ -202,4 +160,22 @@
|
|||||||
return [PhotoTableViewCell heightForPhotoModel:photo withWidth:self.view.bounds.size.width];
|
return [PhotoTableViewCell heightForPhotoModel:photo withWidth:self.view.bounds.size.width];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#pragma mark - UITableViewDelegate methods
|
||||||
|
|
||||||
|
// table automatic tail loading
|
||||||
|
-(void)scrollViewDidScroll:(UIScrollView *)scrollView
|
||||||
|
{
|
||||||
|
CGFloat currentOffSetY = scrollView.contentOffset.y;
|
||||||
|
CGFloat contentHeight = scrollView.contentSize.height;
|
||||||
|
CGFloat screenHeight = [UIScreen mainScreen].bounds.size.height;
|
||||||
|
|
||||||
|
CGFloat screenfullsBeforeBottom = (contentHeight - currentOffSetY) / screenHeight;
|
||||||
|
if (screenfullsBeforeBottom < AUTO_TAIL_LOADING_NUM_SCREENFULS) {
|
||||||
|
[self loadPage];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
//
|
//
|
||||||
// UserModel.h
|
// UserModel.h
|
||||||
// Flickrgram
|
// ASDKgram
|
||||||
//
|
//
|
||||||
// Created by Hannah Troisi on 2/26/16.
|
// Created by Hannah Troisi on 2/26/16.
|
||||||
// Copyright © 2016 Hannah Troisi. All rights reserved.
|
// Copyright © 2016 Hannah Troisi. All rights reserved.
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
//
|
//
|
||||||
// UserModel.m
|
// UserModel.m
|
||||||
// Flickrgram
|
// ASDKgram
|
||||||
//
|
//
|
||||||
// Created by Hannah Troisi on 2/26/16.
|
// Created by Hannah Troisi on 2/26/16.
|
||||||
// Copyright © 2016 Hannah Troisi. All rights reserved.
|
// Copyright © 2016 Hannah Troisi. All rights reserved.
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
//
|
//
|
||||||
// UserRowView.h
|
// UserRowView.h
|
||||||
// Flickrgram
|
// ASDKgram
|
||||||
//
|
//
|
||||||
// Created by Hannah Troisi on 3/13/16.
|
// Created by Hannah Troisi on 3/13/16.
|
||||||
// Copyright © 2016 Hannah Troisi. All rights reserved.
|
// Copyright © 2016 Hannah Troisi. All rights reserved.
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
//
|
//
|
||||||
// UserRowView.m
|
// UserRowView.m
|
||||||
// Flickrgram
|
// ASDKgram
|
||||||
//
|
//
|
||||||
// Created by Hannah Troisi on 3/13/16.
|
// Created by Hannah Troisi on 3/13/16.
|
||||||
// Copyright © 2016 Hannah Troisi. All rights reserved.
|
// Copyright © 2016 Hannah Troisi. All rights reserved.
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
//
|
//
|
||||||
// Utilities.h
|
// Utilities.h
|
||||||
// Flickrgram
|
// ASDKgram
|
||||||
//
|
//
|
||||||
// Created by Hannah Troisi on 3/9/16.
|
// Created by Hannah Troisi on 3/9/16.
|
||||||
// Copyright © 2016 Hannah Troisi. All rights reserved.
|
// Copyright © 2016 Hannah Troisi. All rights reserved.
|
||||||
@ -33,7 +33,9 @@
|
|||||||
|
|
||||||
@interface NSAttributedString (Additions)
|
@interface NSAttributedString (Additions)
|
||||||
|
|
||||||
+ (NSAttributedString *)attributedStringWithString:(NSString *)string fontSize:(CGFloat)size
|
+ (NSAttributedString *)attributedStringWithString:(NSString *)string
|
||||||
color:(UIColor *)color firstWordColor:(UIColor *)firstWordColor;
|
fontSize:(CGFloat)size
|
||||||
|
color:(UIColor *)color
|
||||||
|
firstWordColor:(UIColor *)firstWordColor;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
@ -1,6 +1,6 @@
|
|||||||
//
|
//
|
||||||
// Utilities.m
|
// Utilities.m
|
||||||
// Flickrgram
|
// ASDKgram
|
||||||
//
|
//
|
||||||
// Created by Hannah Troisi on 3/9/16.
|
// Created by Hannah Troisi on 3/9/16.
|
||||||
// Copyright © 2016 Hannah Troisi. All rights reserved.
|
// Copyright © 2016 Hannah Troisi. All rights reserved.
|
||||||
@ -171,9 +171,12 @@
|
|||||||
+ (NSAttributedString *)attributedStringWithString:(NSString *)string fontSize:(CGFloat)size
|
+ (NSAttributedString *)attributedStringWithString:(NSString *)string fontSize:(CGFloat)size
|
||||||
color:(nullable UIColor *)color firstWordColor:(nullable UIColor *)firstWordColor
|
color:(nullable UIColor *)color firstWordColor:(nullable UIColor *)firstWordColor
|
||||||
{
|
{
|
||||||
|
NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] init];
|
||||||
|
|
||||||
|
if (string) {
|
||||||
NSDictionary *attributes = @{NSForegroundColorAttributeName: color ? : [UIColor blackColor],
|
NSDictionary *attributes = @{NSForegroundColorAttributeName: color ? : [UIColor blackColor],
|
||||||
NSFontAttributeName: [UIFont systemFontOfSize:size]};
|
NSFontAttributeName: [UIFont systemFontOfSize:size]};
|
||||||
NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:string];
|
attributedString = [[NSMutableAttributedString alloc] initWithString:string];
|
||||||
[attributedString addAttributes:attributes range:NSMakeRange(0, string.length)];
|
[attributedString addAttributes:attributes range:NSMakeRange(0, string.length)];
|
||||||
|
|
||||||
if (firstWordColor) {
|
if (firstWordColor) {
|
||||||
@ -181,6 +184,7 @@
|
|||||||
NSRange firstWordRange = NSMakeRange(0, firstSpaceRange.location);
|
NSRange firstWordRange = NSMakeRange(0, firstSpaceRange.location);
|
||||||
[attributedString addAttribute:NSForegroundColorAttributeName value:firstWordColor range:firstWordRange];
|
[attributedString addAttribute:NSForegroundColorAttributeName value:firstWordColor range:firstWordRange];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return attributedString;
|
return attributedString;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
|
|
||||||
// main.m
|
// main.m
|
||||||
// Flickrgram
|
// ASDKgram
|
||||||
//
|
//
|
||||||
// Created by Hannah Troisi on 2/16/16.
|
// Created by Hannah Troisi on 2/16/16.
|
||||||
// Copyright © 2016 Hannah Troisi. All rights reserved.
|
// Copyright © 2016 Hannah Troisi. All rights reserved.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user