mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-09-16 17:00:58 +00:00
Changed UITableViewController to UIViewController
This commit is contained in:
parent
112bfa8e71
commit
0f4481718c
@ -27,7 +27,7 @@
|
||||
7688438E1CAA37EF00D8629E /* PhotoFeedNodeController.m in Sources */ = {isa = PBXBuildFile; fileRef = 768843761CAA37EF00D8629E /* PhotoFeedNodeController.m */; };
|
||||
768843901CAA37EF00D8629E /* PhotoModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 768843781CAA37EF00D8629E /* PhotoModel.m */; };
|
||||
768843911CAA37EF00D8629E /* PhotoTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 768843791CAA37EF00D8629E /* PhotoTableViewCell.m */; };
|
||||
768843921CAA37EF00D8629E /* PhotoTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 7688437A1CAA37EF00D8629E /* PhotoTableViewController.m */; };
|
||||
768843921CAA37EF00D8629E /* PhotoFeedViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 7688437A1CAA37EF00D8629E /* PhotoFeedViewController.m */; };
|
||||
768843931CAA37EF00D8629E /* UserModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 7688437B1CAA37EF00D8629E /* UserModel.m */; };
|
||||
768843951CAA37EF00D8629E /* UserRowView.m in Sources */ = {isa = PBXBuildFile; fileRef = 7688437D1CAA37EF00D8629E /* UserRowView.m */; };
|
||||
768843961CAA37EF00D8629E /* Utilities.m in Sources */ = {isa = PBXBuildFile; fileRef = 7688437E1CAA37EF00D8629E /* Utilities.m */; };
|
||||
@ -55,7 +55,7 @@
|
||||
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; lineEnding = 0; path = PhotoModel.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
|
||||
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; lineEnding = 0; path = PhotoTableViewController.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
|
||||
768843621CAA37EF00D8629E /* PhotoFeedViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = PhotoFeedViewController.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
|
||||
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; lineEnding = 0; path = UserRowView.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
|
||||
768843661CAA37EF00D8629E /* Utilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = Utilities.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
|
||||
@ -74,7 +74,7 @@
|
||||
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; lineEnding = 0; path = PhotoModel.m; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objc; };
|
||||
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; lineEnding = 0; path = PhotoTableViewController.m; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objc; };
|
||||
7688437A1CAA37EF00D8629E /* PhotoFeedViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = PhotoFeedViewController.m; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objc; };
|
||||
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; lineEnding = 0; path = UserRowView.m; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objc; };
|
||||
7688437E1CAA37EF00D8629E /* Utilities.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = Utilities.m; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objc; };
|
||||
@ -181,8 +181,8 @@
|
||||
767A5F161CAA3D96004CDA8D /* UIKit */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
768843621CAA37EF00D8629E /* PhotoTableViewController.h */,
|
||||
7688437A1CAA37EF00D8629E /* PhotoTableViewController.m */,
|
||||
768843621CAA37EF00D8629E /* PhotoFeedViewController.h */,
|
||||
7688437A1CAA37EF00D8629E /* PhotoFeedViewController.m */,
|
||||
);
|
||||
name = UIKit;
|
||||
sourceTree = "<group>";
|
||||
@ -371,7 +371,7 @@
|
||||
files = (
|
||||
768843891CAA37EF00D8629E /* main.m in Sources */,
|
||||
7688438C1CAA37EF00D8629E /* PhotoCollectionViewCell.m in Sources */,
|
||||
768843921CAA37EF00D8629E /* PhotoTableViewController.m in Sources */,
|
||||
768843921CAA37EF00D8629E /* PhotoFeedViewController.m in Sources */,
|
||||
768843821CAA37EF00D8629E /* CommentModel.m in Sources */,
|
||||
768843831CAA37EF00D8629E /* CommentsNode.m in Sources */,
|
||||
768843961CAA37EF00D8629E /* Utilities.m in Sources */,
|
||||
|
@ -7,7 +7,7 @@
|
||||
//
|
||||
|
||||
#import "AppDelegate.h"
|
||||
#import "PhotoTableViewController.h"
|
||||
#import "PhotoFeedViewController.h"
|
||||
#import "PhotoFeedNodeController.h"
|
||||
#import "Utilities.h"
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
asdkHomeFeedNavCtrl.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"ASDK" image:[UIImage imageNamed:@"home"] tag:0];
|
||||
|
||||
// ASDK Home Feed viewController & navController
|
||||
PhotoTableViewController *uikitHomeFeedVC = [[PhotoTableViewController 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];
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
//
|
||||
// PhotoTableViewController.h
|
||||
// PhotoFeedViewController.h
|
||||
// ASDKgram
|
||||
//
|
||||
// Created by Hannah Troisi on 2/17/16.
|
||||
@ -8,8 +8,6 @@
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
@interface PhotoTableViewController : UITableViewController
|
||||
|
||||
- (void)refreshFeed;
|
||||
@interface PhotoFeedViewController : UIViewController
|
||||
|
||||
@end
|
@ -1,40 +1,44 @@
|
||||
//
|
||||
// PhotoTableViewController.m
|
||||
// PhotoFeedViewController.m
|
||||
// ASDKgram
|
||||
//
|
||||
// Created by Hannah Troisi on 2/17/16.
|
||||
// Copyright © 2016 Hannah Troisi. All rights reserved.
|
||||
//
|
||||
|
||||
#import "PhotoTableViewController.h"
|
||||
#import "PhotoFeedViewController.h"
|
||||
#import "Utilities.h"
|
||||
#import "PhotoTableViewCell.h"
|
||||
#import "PhotoFeedModel.h"
|
||||
|
||||
#define AUTO_TAIL_LOADING_NUM_SCREENFULS 2.5
|
||||
|
||||
@implementation PhotoTableViewController
|
||||
@interface PhotoFeedViewController () <UITableViewDelegate, UITableViewDataSource>
|
||||
@end
|
||||
|
||||
@implementation PhotoFeedViewController
|
||||
{
|
||||
PhotoFeedModel *_photoFeed;
|
||||
UITableView *_tableView;
|
||||
UIView *_statusBarOpaqueUnderlayView;
|
||||
}
|
||||
|
||||
#pragma mark - Lifecycle
|
||||
|
||||
- (instancetype)initWithStyle:(UITableViewStyle)style
|
||||
- (instancetype)init
|
||||
{
|
||||
self = [super initWithStyle:style];
|
||||
self = [super initWithNibName:nil bundle:nil];
|
||||
|
||||
if (self) {
|
||||
|
||||
self.navigationItem.title = @"UIKit";
|
||||
[self.navigationController setNavigationBarHidden:YES];
|
||||
|
||||
_photoFeed = [[PhotoFeedModel alloc] initWithPhotoFeedModelType:PhotoFeedModelTypePopular imageSize:[self imageSizeForScreenWidth]];
|
||||
[self refreshFeed];
|
||||
|
||||
self.refreshControl = [[UIRefreshControl alloc] init];
|
||||
[self.refreshControl addTarget:self action:@selector(refreshFeed) forControlEvents:UIControlEventValueChanged];
|
||||
_tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
|
||||
_tableView.delegate = self;
|
||||
_tableView.dataSource = self;
|
||||
|
||||
// hack to make status bar opaque
|
||||
_statusBarOpaqueUnderlayView = [[UIView alloc] init];
|
||||
@ -50,9 +54,11 @@
|
||||
{
|
||||
[super viewDidLoad];
|
||||
|
||||
self.tableView.allowsSelection = NO;
|
||||
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
|
||||
[self.tableView registerClass:[PhotoTableViewCell class] forCellReuseIdentifier:@"photoCell"];
|
||||
[self.view addSubview:_tableView];
|
||||
_tableView.frame = self.view.bounds;
|
||||
_tableView.allowsSelection = NO;
|
||||
_tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
|
||||
[_tableView registerClass:[PhotoTableViewCell class] forCellReuseIdentifier:@"photoCell"];
|
||||
|
||||
}
|
||||
|
||||
@ -78,7 +84,6 @@
|
||||
{
|
||||
// small first batch
|
||||
[_photoFeed refreshFeedWithCompletionBlock:^(NSArray *newPhotos){
|
||||
|
||||
[self insertNewRowsInTableView:newPhotos];
|
||||
[self requestCommentsForPhotos:newPhotos];
|
||||
|
||||
@ -102,12 +107,12 @@
|
||||
[photo.commentFeed refreshFeedWithCompletionBlock:^(NSArray *newComments) {
|
||||
|
||||
NSInteger rowNum = [_photoFeed indexOfPhotoModel:photo];
|
||||
PhotoTableViewCell *cell = [self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:rowNum inSection:0]];
|
||||
PhotoTableViewCell *cell = [_tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:rowNum inSection:0]];
|
||||
|
||||
if (cell) {
|
||||
[cell loadCommentsForPhoto:photo];
|
||||
[self.tableView beginUpdates];
|
||||
[self.tableView endUpdates];
|
||||
[_tableView beginUpdates];
|
||||
[_tableView endUpdates];
|
||||
}
|
||||
}];
|
||||
}
|
||||
@ -118,13 +123,13 @@
|
||||
NSInteger section = 0;
|
||||
NSMutableArray *indexPaths = [NSMutableArray array];
|
||||
|
||||
NSUInteger newTotalNumberOfPhotos = [_photoFeed numberOfItemsInFeed];
|
||||
for (NSUInteger row = newTotalNumberOfPhotos - newPhotos.count; row < newTotalNumberOfPhotos; row++) {
|
||||
NSInteger newTotalNumberOfPhotos = [_photoFeed numberOfItemsInFeed];
|
||||
for (NSInteger row = newTotalNumberOfPhotos - newPhotos.count; row < newTotalNumberOfPhotos; row++) {
|
||||
NSIndexPath *path = [NSIndexPath indexPathForRow:row inSection:section];
|
||||
[indexPaths addObject:path];
|
||||
}
|
||||
|
||||
[self.tableView insertRowsAtIndexPaths:indexPaths withRowAnimation:UITableViewRowAnimationNone];
|
||||
[_tableView insertRowsAtIndexPaths:indexPaths withRowAnimation:UITableViewRowAnimationNone];
|
||||
}
|
||||
|
||||
- (UIStatusBarStyle)preferredStatusBarStyle
|
Loading…
x
Reference in New Issue
Block a user