Skip to content

Commit

Permalink
Support for iPhone X and iOS 11
Browse files Browse the repository at this point in the history
  • Loading branch information
Wildog committed Nov 15, 2017
1 parent 8f47c94 commit d6df7a4
Show file tree
Hide file tree
Showing 31 changed files with 301 additions and 149 deletions.
20 changes: 19 additions & 1 deletion Gankee.xcodeproj/project.pbxproj
Expand Up @@ -54,6 +54,7 @@
15D9BA5E1E3A2E8F0020C283 /* UIView+SDExtension.m in Sources */ = {isa = PBXBuildFile; fileRef = 15D9BA571E3A2E8F0020C283 /* UIView+SDExtension.m */; };
15DA126F1E40C303001B75A6 /* GKItem.m in Sources */ = {isa = PBXBuildFile; fileRef = 1569A1901E35D689009F1E46 /* GKItem.m */; };
15EF4CF21E3AF89C00FA6A04 /* GKPieLayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 15EF4CF11E3AF89C00FA6A04 /* GKPieLayer.m */; };
15FC18861FBBEC6600B6E9E8 /* GKTitleView.m in Sources */ = {isa = PBXBuildFile; fileRef = 15FC18851FBBEC6600B6E9E8 /* GKTitleView.m */; };
331E5721F2C0E02D225123C5 /* libPods-Share Extension.a in Frameworks */ = {isa = PBXBuildFile; fileRef = E6AF3C2E842ECE6E8120FED8 /* libPods-Share Extension.a */; };
8AFCDD311917514910D1CEA0 /* libPods-Gankee.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9FD3146582E3823EBEB1936C /* libPods-Gankee.a */; };
/* End PBXBuildFile section */
Expand Down Expand Up @@ -168,6 +169,8 @@
15D9BA571E3A2E8F0020C283 /* UIView+SDExtension.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIView+SDExtension.m"; sourceTree = "<group>"; };
15EF4CF01E3AF89C00FA6A04 /* GKPieLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GKPieLayer.h; sourceTree = "<group>"; };
15EF4CF11E3AF89C00FA6A04 /* GKPieLayer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GKPieLayer.m; sourceTree = "<group>"; };
15FC18841FBBEC6600B6E9E8 /* GKTitleView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GKTitleView.h; sourceTree = "<group>"; };
15FC18851FBBEC6600B6E9E8 /* GKTitleView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = GKTitleView.m; sourceTree = "<group>"; };
1ED5307FC54FFD72242EBB4E /* Pods-ShareAction.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ShareAction.release.xcconfig"; path = "Pods/Target Support Files/Pods-ShareAction/Pods-ShareAction.release.xcconfig"; sourceTree = "<group>"; };
5E46AEC01AEAB05D099024FB /* Pods-Gankee.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Gankee.release.xcconfig"; path = "Pods/Target Support Files/Pods-Gankee/Pods-Gankee.release.xcconfig"; sourceTree = "<group>"; };
6D9CE4FD0975C99AC916C93C /* Pods-Share Extension.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Share Extension.release.xcconfig"; path = "Pods/Target Support Files/Pods-Share Extension/Pods-Share Extension.release.xcconfig"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -424,6 +427,8 @@
15A9D8B31E3B20480020C459 /* GKPieView */,
1560E71B1E3D1ED100E3BBD8 /* WDScrollableSegmentedControl */,
156E7A861E3F818C005E469C /* WDHoshiTextField */,
15FC18841FBBEC6600B6E9E8 /* GKTitleView.h */,
15FC18851FBBEC6600B6E9E8 /* GKTitleView.m */,
);
path = "Custom Views";
sourceTree = "<group>";
Expand Down Expand Up @@ -531,7 +536,7 @@
1569A1591E35BAED009F1E46 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0820;
LastUpgradeCheck = 0910;
ORGANIZATIONNAME = Wildog;
TargetAttributes = {
1569A1601E35BAED009F1E46 = {
Expand Down Expand Up @@ -683,6 +688,7 @@
15D9BA5A1E3A2E8F0020C283 /* TADotView.m in Sources */,
15C2D38F1E40C23100E8A49F /* GKItem.m in Sources */,
1569A16F1E35BAEE009F1E46 /* GKCategoriesViewController.m in Sources */,
15FC18861FBBEC6600B6E9E8 /* GKTitleView.m in Sources */,
1569A1691E35BAEE009F1E46 /* AppDelegate.m in Sources */,
15EF4CF21E3AF89C00FA6A04 /* GKPieLayer.m in Sources */,
15D9BA581E3A2E8F0020C283 /* TAAbstractDotView.m in Sources */,
Expand Down Expand Up @@ -777,15 +783,21 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
Expand Down Expand Up @@ -825,15 +837,21 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
Expand Down
4 changes: 3 additions & 1 deletion Gankee.xcodeproj/xcshareddata/xcschemes/Gankee.xcscheme
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0820"
LastUpgradeVersion = "0910"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -26,6 +26,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
Expand All @@ -45,6 +46,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand Down
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0820"
LastUpgradeVersion = "0910"
wasCreatedForAppExtension = "YES"
version = "2.0">
<BuildAction
Expand Down Expand Up @@ -41,6 +41,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
Expand All @@ -60,6 +61,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = ""
selectedLauncherIdentifier = "Xcode.IDEFoundation.Launcher.PosixSpawn"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand Down
Expand Up @@ -2,4 +2,16 @@
<Bucket
type = "0"
version = "2.0">
<Breakpoints>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.ExceptionBreakpoint">
<BreakpointContent
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
scope = "0"
stopOnStyle = "0">
</BreakpointContent>
</BreakpointProxy>
</Breakpoints>
</Bucket>
3 changes: 3 additions & 0 deletions Gankee/AppDelegate.m
Expand Up @@ -25,6 +25,9 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
[IQKeyboardManager sharedManager].enableAutoToolbar = NO;
[IQKeyboardManager sharedManager].keyboardDistanceFromTextField = 160;

// window background color
self.window.backgroundColor = [UIColor whiteColor];

// setup core data
if ([[NSFileManager defaultManager] ubiquityIdentityToken]) {
[self iCloudCoreDataSetup];
Expand Down
6 changes: 6 additions & 0 deletions Gankee/Assets.xcassets/AppIcon.appiconset/Contents.json
Expand Up @@ -47,6 +47,12 @@
"idiom" : "iphone",
"filename" : "Icon-60@3x.png",
"scale" : "3x"
},
{
"size" : "1024x1024",
"idiom" : "ios-marketing",
"filename" : "icon.png",
"scale" : "1x"
}
],
"info" : {
Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions Gankee/Custom Views/GKTitleView.h
@@ -0,0 +1,15 @@
//
// GKTitleView.h
// Gankee
//
// Created by Wildog on 11/15/17.
// Copyright © 2017 Wildog. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface GKTitleView : UIView

@property (nonatomic, assign) CGFloat preferredWidth;

@end
26 changes: 26 additions & 0 deletions Gankee/Custom Views/GKTitleView.m
@@ -0,0 +1,26 @@
//
// GKTitleView.m
// Gankee
//
// Created by Wildog on 11/15/17.
// Copyright © 2017 Wildog. All rights reserved.
//

#import "GKTitleView.h"

@implementation GKTitleView

- (CGSize)intrinsicContentSize {
if (self.preferredWidth > 0) {
return CGSizeMake(self.preferredWidth, 44);
}
return UILayoutFittingExpandedSize;
}

- (void)setValue:(id)value forKeyPath:(NSString *)keyPath {
if ([keyPath isEqualToString:@"preferredWidth"]) {
self.preferredWidth = [value doubleValue];
}
}

@end
18 changes: 15 additions & 3 deletions Gankee/Favorite Scene/GKFavoriteViewController.m
Expand Up @@ -21,6 +21,10 @@ @interface GKFavoriteViewController () <UITableViewDataSource, UITableViewDelega
@property (strong, nonatomic) IBOutlet UIButton *settingButton;
@property (weak, nonatomic) IBOutlet UILabel *noResultLabel;
@property (weak, nonatomic) IBOutlet UIView *alertView;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *topConstraint;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *bottomConstraint;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *extendedTopConstraint;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *extendedBottomContraint;

@property (strong, nonatomic) UISearchController *searchController;
@property (strong, nonatomic) NSFetchedResultsController *fetchedResultsController;
Expand Down Expand Up @@ -52,7 +56,6 @@ - (NSDateFormatter *)dateFormatter {
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
self.automaticallyAdjustsScrollViewInsets = NO;
self.navigationItem.titleView = self.titleView;
self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:self.settingButton];

Expand All @@ -61,12 +64,21 @@ - (void)viewDidLoad {
self.searchController.searchBar.placeholder = @"搜索本地收藏";
self.searchController.searchBar.searchBarStyle = UISearchBarStyleMinimal;
self.searchController.searchBar.tintColor = [UIColor colorWithRed:0.08 green:0.58 blue:0.53 alpha:0.9];
self.searchController.searchBar.backgroundColor = [UIColor whiteColor];
self.searchController.searchResultsUpdater = self;
if (@available(iOS 11.0, *)) {
self.navigationItem.searchController = self.searchController;
self.topConstraint.active = self.bottomConstraint.active = NO;
self.extendedTopConstraint.active = self.extendedBottomContraint.active = YES;
} else {
self.tableView.tableHeaderView = self.searchController.searchBar;
self.searchController.searchBar.backgroundColor = [UIColor whiteColor];
self.automaticallyAdjustsScrollViewInsets = NO;
self.topConstraint.active = self.bottomConstraint.active = YES;
self.extendedTopConstraint.active = self.extendedBottomContraint.active = NO;
}

self.tableView.rowHeight = UITableViewAutomaticDimension;
self.tableView.estimatedRowHeight = 80;
self.tableView.tableHeaderView = self.searchController.searchBar;
self.tableView.tableFooterView = [UIView new];
self.tableView.delegate = self;
self.tableView.dataSource = self;
Expand Down
3 changes: 0 additions & 3 deletions Gankee/Home Scene/GKHomeViewController.m
Expand Up @@ -324,9 +324,6 @@ - (void)viewDidLoad {

- (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
[UIView animateWithDuration:0.2 animations:^{
self.tabBarController.tabBar.transform = CGAffineTransformIdentity;
} completion:nil];
[self check3DTouch];
}

Expand Down
14 changes: 7 additions & 7 deletions Gankee/Home Scene/GKSearchViewController.m
Expand Up @@ -93,7 +93,7 @@ - (NSDateFormatter *)dateFormatter {
- (void)viewDidLoad {
[super viewDidLoad];
self.navigationItem.titleView = self.titleView;
self.automaticallyAdjustsScrollViewInsets = NO;
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:self.menu];

self.categories = @[@"全部分类", @"iOS", @"Android", @"App", @"前端", @"瞎推荐", @"拓展资源", @"休息视频", @"福利"];
self.menu.delegate = self;
Expand All @@ -106,11 +106,6 @@ - (void)viewDidLoad {
self.tableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero];
self.tableView.infiniteScrollIndicatorMargin = 22;

[UIView animateWithDuration:0.3 animations:^{
self.tabBarController.tabBar.transform = CGAffineTransformMakeTranslation(0, self.tabBarController.tabBar.frame.size.height);
}];
[self.textField becomeFirstResponder];

@weakify(self)
[[[[[[[self.textField.rac_textSignal deliverOnMainThread] distinctUntilChanged] doNext:^(NSString * _Nullable x) {
if (x.length == 0) {
Expand Down Expand Up @@ -177,6 +172,11 @@ - (void)viewDidLoad {
@strongify(self)
[self.tableView reloadData];
}];

[[[self rac_signalForSelector:@selector(viewDidAppear:)] take:1] subscribeNext:^(id _Nullable x) {
@strongify(self)
[self.textField becomeFirstResponder];
}];
}

- (void)viewWillDisappear:(BOOL)animated {
Expand Down Expand Up @@ -246,7 +246,7 @@ - (NSAttributedString *)dropdownMenu:(MKDropdownMenu *)dropdownMenu attributedTi
NSString *title = self.categories[self.viewModel.category];
return [[NSAttributedString alloc] initWithString:title
attributes:@{NSFontAttributeName: [UIFont systemFontOfSize:17],
NSForegroundColorAttributeName: self.navigationController.navigationBar.tintColor}];
NSForegroundColorAttributeName: GOSSAMER}];
}

- (NSAttributedString *)dropdownMenu:(MKDropdownMenu *)dropdownMenu attributedTitleForRow:(NSInteger)row forComponent:(NSInteger)component {
Expand Down
4 changes: 2 additions & 2 deletions Gankee/Info.plist
Expand Up @@ -15,9 +15,9 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.1.0</string>
<string>1.1.1</string>
<key>CFBundleVersion</key>
<string>1100</string>
<string>1110</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSAppTransportSecurity</key>
Expand Down
4 changes: 3 additions & 1 deletion Gankee/Models/GKItem.m
Expand Up @@ -25,7 +25,9 @@ - (BOOL)modelCustomTransformFromDictionary:(NSDictionary *)dic {
if ([imageURL containsString:@"img.gank.io"] || [imageURL containsString:@"https://"]) {
NSString *urlString = [NSString stringWithFormat:@"%@%@", imageURL, @"?imageView2/2/w/200/format/jpg/interlace/1"];
NSURL *url = [NSURL URLWithString:urlString];
[images addObject:url];
if (url) {
[images addObject:url];
}
}
}
_images = images;
Expand Down

0 comments on commit d6df7a4

Please sign in to comment.