diff --git a/.travis.yml b/.travis.yml index 1f1c01d..420ae11 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,6 +2,7 @@ osx_image: xcode7.3 language: objective-c xcode_project: v2ex-iOS.xcodeproj # path to your xcodeproj folder xcode_scheme: v2ex-dev +script: xctool -project v2ex-iOS.xcodeproj -scheme v2ex-dev build CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO cache: cocoapods diff --git a/Podfile b/Podfile index e69a86c..5b8abf9 100644 --- a/Podfile +++ b/Podfile @@ -2,7 +2,7 @@ platform :ios, '7.0' inhibit_all_warnings! def pods - pod 'AFNetworking', '~> 2.2.0' + pod 'AFNetworking', '~> 2.2' pod 'NYXImagesKit', '~> 2.3' pod 'FXKeychain', '~> 1.5' pod 'BlocksKit', '~> 2.2.0' @@ -11,6 +11,8 @@ def pods pod 'MWFeedParser', '~> 1.0.1' pod 'RegexKitLite', '~> 4.0' pod 'MBProgressHUD', '~> 0.8' +end + post_install do |installer_representation| installer_representation.pods_project.targets.each do |target| target.build_configurations.each do |config| @@ -18,7 +20,6 @@ def pods end end end -end target "v2ex-dev" do pods diff --git a/README.md b/README.md index 81fdc3c..d44262b 100644 --- a/README.md +++ b/README.md @@ -1,23 +1,25 @@ [![Build Status](https://travis-ci.org/singro/v2ex.svg?branch=master)](https://travis-ci.org/singro/v2ex) -####关于 +#### 关于 V2EX for iOS -####下载 +#### 下载 https://itunes.apple.com/us/app/v2ex-chuang-yi-gong-zuo-zhe/id898181535?ls=1&mt=8 -####截图 +#### 截图 + ![ScreenShoot 1](http://i.v2ex.co/EwnuC7uf.png) -####运行 +#### 运行 + ``` pod install ``` 若出现 `ld: library not found for -lPods-AFNetworking` 类似的, 设置 `Project` -> `Pods` 的 `Build Active Architecture Only` 为 `NO` -####部分独立组件 +#### 部分独立组件 * [SCPullRefresh](https://github.com/singro/SCPullRefresh) ``` @@ -35,7 +37,9 @@ pod install 对微博官方 SDK 的 block 封装。 更加易用,配置更简单。 ``` -####说明 + + +#### 说明 1. `发图功能` 目前通过绑定微博后,发一条带图片的微博到密友来实现。*(更好的方法有待研究)* @@ -49,15 +53,15 @@ pod install 4. `HTTPS` 默认是以 HTTP 访问所有接口,考虑被墙,稍后后更新支持 HTTPS 切换的版本到 App Store -####已知的 bug +#### 已知的 bug * ~~话题内容过长时微信分享失败 [1.0.0]~~ * ~~连续回复时,第二次回复失败 [1.0.0]~~ * 某几个帖子点开 Crash [1.0.0] -####LICENSE +#### LICENSE MIT -####捐赠 +#### 捐赠 支付宝(singroapp#gmail.com): ![donate](http://i.v2ex.co/2O0eZEc9b.png) diff --git a/v2ex-iOS.xcodeproj/project.pbxproj b/v2ex-iOS.xcodeproj/project.pbxproj index 48c3585..878539b 100644 --- a/v2ex-iOS.xcodeproj/project.pbxproj +++ b/v2ex-iOS.xcodeproj/project.pbxproj @@ -262,6 +262,8 @@ 29DC02411A9B2020004E541B /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 29DC02401A9B2020004E541B /* libz.dylib */; }; 29DC02431A9B2029004E541B /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 29DC02421A9B2029004E541B /* SystemConfiguration.framework */; }; 29DC02451A9B2103004E541B /* libc++.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 29DC02441A9B2103004E541B /* libc++.dylib */; }; + 29DE37541FD2855500D367D8 /* UIView+SafeArea.m in Sources */ = {isa = PBXBuildFile; fileRef = 29DE37531FD2855500D367D8 /* UIView+SafeArea.m */; }; + 29DE379A1FD2896A00D367D8 /* UIView+SafeArea.m in Sources */ = {isa = PBXBuildFile; fileRef = 29DE37531FD2855500D367D8 /* UIView+SafeArea.m */; }; 29E0C7D018D89D2F00AFB36E /* V2TopicViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 29E0C7CF18D89D2F00AFB36E /* V2TopicViewController.m */; }; 29E374B1191B67B300704F9B /* V2NodesViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 29E374B0191B67B300704F9B /* V2NodesViewCell.m */; }; 29E5FA1518F6DD7B008B5275 /* V2SettingManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 29E5FA1418F6DD7B008B5275 /* V2SettingManager.m */; }; @@ -516,6 +518,8 @@ 29DC02401A9B2020004E541B /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = usr/lib/libz.dylib; sourceTree = SDKROOT; }; 29DC02421A9B2029004E541B /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = System/Library/Frameworks/SystemConfiguration.framework; sourceTree = SDKROOT; }; 29DC02441A9B2103004E541B /* libc++.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = "libc++.dylib"; path = "usr/lib/libc++.dylib"; sourceTree = SDKROOT; }; + 29DE37521FD2855500D367D8 /* UIView+SafeArea.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "UIView+SafeArea.h"; sourceTree = ""; }; + 29DE37531FD2855500D367D8 /* UIView+SafeArea.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "UIView+SafeArea.m"; sourceTree = ""; }; 29E0C7CE18D89D2F00AFB36E /* V2TopicViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = V2TopicViewController.h; sourceTree = ""; }; 29E0C7CF18D89D2F00AFB36E /* V2TopicViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = V2TopicViewController.m; sourceTree = ""; }; 29E374AF191B67B300704F9B /* V2NodesViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = V2NodesViewCell.h; sourceTree = ""; }; @@ -685,6 +689,8 @@ children = ( 2927F0A018D7470800242167 /* NSDictionary+NotNullKey.h */, 2927F0A118D7470800242167 /* NSDictionary+NotNullKey.m */, + 29DE37521FD2855500D367D8 /* UIView+SafeArea.h */, + 29DE37531FD2855500D367D8 /* UIView+SafeArea.m */, ); path = Categories; sourceTree = ""; @@ -1217,8 +1223,16 @@ isa = PBXProject; attributes = { CLASSPREFIX = V2; - LastUpgradeCheck = 0730; + LastUpgradeCheck = 0820; ORGANIZATIONNAME = Singro; + TargetAttributes = { + 2933868618D67B6B00FEC28E = { + DevelopmentTeam = 8KZ3G3A2FQ; + }; + 29C0BDB21BA3A89E007B110C = { + DevelopmentTeam = 8KZ3G3A2FQ; + }; + }; }; buildConfigurationList = 2933868218D67B6B00FEC28E /* Build configuration list for PBXProject "v2ex-iOS" */; compatibilityVersion = "Xcode 3.2"; @@ -1394,6 +1408,7 @@ 29CDF9C11931768700C6B952 /* SCNavigationPushAnimation.m in Sources */, 2987FFDE194D8ADB00794894 /* IDMPhotoBrowser.m in Sources */, 29CB5FCB18F186B700357D5B /* HTMLParser.m in Sources */, + 29DE37541FD2855500D367D8 /* UIView+SafeArea.m in Sources */, 2968EACE195CAA7E0000E8BD /* V2SettingCell.m in Sources */, 29964F6818D9F3410039F31C /* V2TopicInfoCell.m in Sources */, 29290A8F19339D82002D2950 /* SCActionSheet.m in Sources */, @@ -1512,6 +1527,7 @@ 29C0BDBA1BA3A89E007B110C /* SCNavigationPushAnimation.m in Sources */, 29C0BDBB1BA3A89E007B110C /* IDMPhotoBrowser.m in Sources */, 29C0BDBC1BA3A89E007B110C /* HTMLParser.m in Sources */, + 29DE379A1FD2896A00D367D8 /* UIView+SafeArea.m in Sources */, 29C0BDBD1BA3A89E007B110C /* V2SettingCell.m in Sources */, 29C0BDBE1BA3A89E007B110C /* V2TopicInfoCell.m in Sources */, 29C0BDBF1BA3A89E007B110C /* SCActionSheet.m in Sources */, @@ -1637,6 +1653,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; @@ -1646,15 +1663,20 @@ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer: Xingrong Chen (S8A223NWX3)"; COPY_PHASE_STRIP = NO; ENABLE_BITCODE = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", @@ -1667,7 +1689,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 7.0; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; ONLY_ACTIVE_ARCH = YES; PROVISIONING_PROFILE = "7853719e-7d97-4121-b7c2-5ec685fc66e3"; SDKROOT = iphoneos; @@ -1678,6 +1700,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; @@ -1687,21 +1710,26 @@ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; COPY_PHASE_STRIP = YES; ENABLE_BITCODE = NO; ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 7.0; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; ONLY_ACTIVE_ARCH = NO; PROVISIONING_PROFILE = "79341f7b-b5d3-4650-9930-b1d407c8a6aa"; SDKROOT = iphoneos; @@ -1718,6 +1746,7 @@ ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + DEVELOPMENT_TEAM = 8KZ3G3A2FQ; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -1727,7 +1756,7 @@ GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "v2ex-iOS/v2ex-iOS-Prefix.pch"; INFOPLIST_FILE = "v2ex-iOS/v2ex-iOS-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 7.0; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; LIBRARY_SEARCH_PATHS = ( "$(inherited)", "$(PROJECT_DIR)/v2ex-iOS/Additions/libWeiboSDK", @@ -1752,6 +1781,7 @@ ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + DEVELOPMENT_TEAM = 8KZ3G3A2FQ; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -1761,7 +1791,7 @@ GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "v2ex-iOS/v2ex-iOS-Prefix.pch"; INFOPLIST_FILE = "v2ex-iOS/v2ex-iOS-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 7.0; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; LIBRARY_SEARCH_PATHS = ( "$(inherited)", "$(PROJECT_DIR)/v2ex-iOS/Additions/libWeiboSDK", @@ -1786,6 +1816,7 @@ ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + DEVELOPMENT_TEAM = 8KZ3G3A2FQ; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -1795,7 +1826,7 @@ GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "v2ex-iOS/v2ex-iOS-Prefix.pch"; INFOPLIST_FILE = "v2ex-iOS/v2ex-iOS-Crashlytics-info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 7.0; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; LIBRARY_SEARCH_PATHS = ( "$(inherited)", "$(PROJECT_DIR)/v2ex-iOS/Additions/libWeiboSDK", @@ -1821,6 +1852,7 @@ ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + DEVELOPMENT_TEAM = 8KZ3G3A2FQ; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -1830,7 +1862,7 @@ GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "v2ex-iOS/v2ex-iOS-Prefix.pch"; INFOPLIST_FILE = "v2ex-iOS/v2ex-iOS-Crashlytics-info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 7.0; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; LIBRARY_SEARCH_PATHS = ( "$(inherited)", "$(PROJECT_DIR)/v2ex-iOS/Additions/libWeiboSDK", diff --git a/v2ex-iOS.xcodeproj/xcshareddata/xcschemes/v2ex-dev.xcscheme b/v2ex-iOS.xcodeproj/xcshareddata/xcschemes/v2ex-dev.xcscheme index 1b9b515..e24718c 100644 --- a/v2ex-iOS.xcodeproj/xcshareddata/xcschemes/v2ex-dev.xcscheme +++ b/v2ex-iOS.xcodeproj/xcshareddata/xcschemes/v2ex-dev.xcscheme @@ -1,6 +1,6 @@ + +@interface UIView (SafeArea) + +@property (class, nonatomic, readonly) CGFloat sc_statusBarHeight; // 37 for iPhone X, 20 for Others +@property (class, nonatomic, readonly) CGFloat sc_navigationBarHeighExcludeStatusBar; // 44 +@property (class, nonatomic, readonly) CGFloat sc_navigationBarHeight; // status + naviExStatus +@property (class, nonatomic, readonly) CGFloat sc_bottomInset; + +@end diff --git a/v2ex-iOS/Additions/Categories/UIView+SafeArea.m b/v2ex-iOS/Additions/Categories/UIView+SafeArea.m new file mode 100644 index 0000000..f3d639e --- /dev/null +++ b/v2ex-iOS/Additions/Categories/UIView+SafeArea.m @@ -0,0 +1,39 @@ +// +// UIView+SafeArea.m +// v2ex-dev +// +// Created by Singro on 02/12/2017. +// Copyright © 2017 Singro. All rights reserved. +// + +#import "UIView+SafeArea.h" + +@implementation UIView (SafeArea) + ++ (CGFloat)sc_statusBarHeight +{ + if (@available(iOS 11.0, *)) { + return UIApplication.sharedApplication.keyWindow.safeAreaInsets.top; + } + return 20; +} + ++ (CGFloat)sc_navigationBarHeighExcludeStatusBar +{ + return 44; +} + ++ (CGFloat)sc_navigationBarHeight +{ + return self.sc_statusBarHeight + self.sc_navigationBarHeighExcludeStatusBar; +} + ++ (CGFloat)sc_bottomInset +{ + if (@available(iOS 11.0, *)) { + return UIApplication.sharedApplication.keyWindow.safeAreaInsets.bottom; + } + return 0; +} + +@end diff --git a/v2ex-iOS/Additions/HTMLParser/HTMLParser.m b/v2ex-iOS/Additions/HTMLParser/HTMLParser.m index 5cd94eb..15e031c 100755 --- a/v2ex-iOS/Additions/HTMLParser/HTMLParser.m +++ b/v2ex-iOS/Additions/HTMLParser/HTMLParser.m @@ -53,7 +53,7 @@ -(id)initWithString:(NSString*)string error:(NSError**)error { CFStringEncoding cfenc = CFStringConvertNSStringEncodingToEncoding(NSUTF8StringEncoding); CFStringRef cfencstr = CFStringConvertEncodingToIANACharSetName(cfenc); - const char *enc = CFStringGetCStringPtr(cfencstr, 0); + const char *enc = [(__bridge NSString *)cfencstr UTF8String]; // _doc = htmlParseDoc((xmlChar*)[string UTF8String], enc); int optionsHtml = HTML_PARSE_RECOVER; optionsHtml = optionsHtml | HTML_PARSE_NOERROR; //Uncomment this to see HTML errors diff --git a/v2ex-iOS/Additions/SCActionSheet/SCActionSheet.m b/v2ex-iOS/Additions/SCActionSheet/SCActionSheet.m index 50ee744..ef213dc 100644 --- a/v2ex-iOS/Additions/SCActionSheet/SCActionSheet.m +++ b/v2ex-iOS/Additions/SCActionSheet/SCActionSheet.m @@ -204,7 +204,7 @@ - (instancetype)initWithTitles:(NSArray *)titles customViews:(NSArray *)customVi [buttonContainView addSubview:lineView]; // layout - buttonContainView.frame = (CGRect){0, 0, kScreenWidth, kButtonHeight + 10}; + buttonContainView.frame = (CGRect){0, 0, kScreenWidth, kButtonHeight + 10 + UIView.sc_bottomInset}; button.y = 5; [self.contentView addSubview:buttonContainView]; diff --git a/v2ex-iOS/Additions/SCNavitagionController/SCBarButtonItem.m b/v2ex-iOS/Additions/SCNavitagionController/SCBarButtonItem.m index b53959a..7bdb720 100644 --- a/v2ex-iOS/Additions/SCNavitagionController/SCBarButtonItem.m +++ b/v2ex-iOS/Additions/SCNavitagionController/SCBarButtonItem.m @@ -43,9 +43,9 @@ - (instancetype)initWithTitle:(NSString *)title style:(SCBarButtonItemStyle)styl [button.titleLabel setFont:[UIFont systemFontOfSize:15]]; [button setTitleColor:kNavigationBarTintColor forState:UIControlStateNormal]; [button sizeToFit]; - button.height = 44; + button.height = UIView.sc_navigationBarHeighExcludeStatusBar; button.width += 30; - button.centerY = 20 + 22; + button.centerY = UIView.sc_statusBarHeight + UIView.sc_navigationBarHeighExcludeStatusBar / 2; button.x = 0; self.view = button; @@ -83,9 +83,9 @@ - (instancetype)initWithImage:(UIImage *)image style:(SCBarButtonItemStyle)style [button setImage:image forState:UIControlStateNormal]; [button setImage:image forState:UIControlStateHighlighted]; [button sizeToFit]; - button.height = 44; + button.height = UIView.sc_navigationBarHeighExcludeStatusBar; button.width += 30; - button.centerY = 20 + 22; + button.centerY = UIView.sc_statusBarHeight + UIView.sc_navigationBarHeighExcludeStatusBar / 2; button.x = 0; self.view = button; diff --git a/v2ex-iOS/Additions/SCNavitagionController/SCNavigationItem.m b/v2ex-iOS/Additions/SCNavitagionController/SCNavigationItem.m index c3dd2d0..0708650 100644 --- a/v2ex-iOS/Additions/SCNavitagionController/SCNavigationItem.m +++ b/v2ex-iOS/Additions/SCNavitagionController/SCNavigationItem.m @@ -50,7 +50,7 @@ - (void)setTitle:(NSString *)title { [_titleLabel sizeToFit]; NSUInteger otherButtonWidth = self.leftBarButtonItem.view.width + self.rightBarButtonItem.view.width; _titleLabel.width = kScreenWidth - otherButtonWidth - 20; - _titleLabel.centerY = 42; + _titleLabel.centerY = UIView.sc_statusBarHeight + UIView.sc_navigationBarHeighExcludeStatusBar / 2; _titleLabel.centerX = kScreenWidth/2; } @@ -60,7 +60,7 @@ - (void)setLeftBarButtonItem:(SCBarButtonItem *)leftBarButtonItem { if (__sc_viewController) { [_leftBarButtonItem.view removeFromSuperview]; leftBarButtonItem.view.x = 0; - leftBarButtonItem.view.centerY = 42; + leftBarButtonItem.view.centerY = UIView.sc_statusBarHeight + UIView.sc_navigationBarHeighExcludeStatusBar / 2; [__sc_viewController.sc_navigationBar addSubview:leftBarButtonItem.view]; } @@ -72,7 +72,7 @@ - (void)setRightBarButtonItem:(SCBarButtonItem *)rightBarButtonItem { if (__sc_viewController) { [_rightBarButtonItem.view removeFromSuperview]; rightBarButtonItem.view.x = kScreenWidth - rightBarButtonItem.view.width; - rightBarButtonItem.view.centerY = 42; + rightBarButtonItem.view.centerY = UIView.sc_statusBarHeight + UIView.sc_navigationBarHeighExcludeStatusBar / 2; [__sc_viewController.sc_navigationBar addSubview:rightBarButtonItem.view]; } diff --git a/v2ex-iOS/Additions/SCNavitagionController/SCNavigationPopAnimation.m b/v2ex-iOS/Additions/SCNavitagionController/SCNavigationPopAnimation.m index cdac294..56673c3 100644 --- a/v2ex-iOS/Additions/SCNavitagionController/SCNavigationPopAnimation.m +++ b/v2ex-iOS/Additions/SCNavitagionController/SCNavigationPopAnimation.m @@ -38,7 +38,7 @@ - (instancetype)init { self.maskImageView = [[UIImageView alloc] initWithFrame:(CGRect){0, 20, kScreenWidth, 44}]; self.maskImageView.image = [UIImage imageNamed:@"navi_mask"]; - self.naviContainView = [[UIView alloc] initWithFrame:(CGRect){0, 0, kScreenWidth, 64}]; + self.naviContainView = [[UIView alloc] initWithFrame:(CGRect){0, 0, kScreenWidth, UIView.sc_navigationBarHeight}]; self.naviContainView.backgroundColor = [UIColor colorWithRed:0.774 green:0.368 blue:1.000 alpha:0.810]; } @@ -83,11 +83,11 @@ - (void)animateTransition:(id)transitionCo ; } else { - naviBarView = [[UIView alloc] initWithFrame:(CGRect){0, 0, kScreenWidth, 64}]; + naviBarView = [[UIView alloc] initWithFrame:(CGRect){0, 0, kScreenWidth, UIView.sc_navigationBarHeight}]; naviBarView.backgroundColor = kNavigationBarColor; [containerView addSubview:naviBarView]; - UIView *lineView = [[UIView alloc] initWithFrame:(CGRect){0, 64, kScreenWidth, 0.5}]; + UIView *lineView = [[UIView alloc] initWithFrame:(CGRect){0, UIView.sc_navigationBarHeight, kScreenWidth, 0.5}]; lineView.backgroundColor = kNavigationBarLineColor; [naviBarView addSubview:lineView]; diff --git a/v2ex-iOS/Additions/SCNavitagionController/SCNavigationPushAnimation.m b/v2ex-iOS/Additions/SCNavitagionController/SCNavigationPushAnimation.m index af3f090..e767d60 100644 --- a/v2ex-iOS/Additions/SCNavitagionController/SCNavigationPushAnimation.m +++ b/v2ex-iOS/Additions/SCNavitagionController/SCNavigationPushAnimation.m @@ -55,11 +55,11 @@ - (void)animateTransition:(id)transitionCo ; } else { - naviBarView = [[UIView alloc] initWithFrame:(CGRect){0, 0, kScreenWidth, 64}]; + naviBarView = [[UIView alloc] initWithFrame:(CGRect){0, 0, kScreenWidth, UIView.sc_navigationBarHeight}]; naviBarView.backgroundColor = kNavigationBarColor; [containerView addSubview:naviBarView]; - UIView *lineView = [[UIView alloc] initWithFrame:(CGRect){0, 64, kScreenWidth, 0.5}]; + UIView *lineView = [[UIView alloc] initWithFrame:(CGRect){0, UIView.sc_navigationBarHeight, kScreenWidth, 0.5}]; lineView.backgroundColor = kNavigationBarLineColor; [naviBarView addSubview:lineView]; diff --git a/v2ex-iOS/Additions/SCNavitagionController/SCViewController+NaviBar.m b/v2ex-iOS/Additions/SCNavitagionController/SCViewController+NaviBar.m index cac2af4..15d8b1b 100644 --- a/v2ex-iOS/Additions/SCNavitagionController/SCViewController+NaviBar.m +++ b/v2ex-iOS/Additions/SCNavitagionController/SCViewController+NaviBar.m @@ -80,7 +80,7 @@ - (void)setSc_navigationBarHidden:(BOOL)sc_navigationBarHidden { - (void)sc_setNavigationBarHidden:(BOOL)hidden animated:(BOOL)animated { if (hidden) { [UIView animateWithDuration:0.3 animations:^{ - self.sc_navigationBar.y = -44; + self.sc_navigationBar.y = -UIView.sc_navigationBarHeighExcludeStatusBar; for (UIView *view in self.sc_navigationBar.subviews) { view.alpha = 0.0; } diff --git a/v2ex-iOS/Additions/SCNavitagionController/V2NavigationBar.m b/v2ex-iOS/Additions/SCNavitagionController/V2NavigationBar.m index 77d913a..eb9501a 100644 --- a/v2ex-iOS/Additions/SCNavitagionController/V2NavigationBar.m +++ b/v2ex-iOS/Additions/SCNavitagionController/V2NavigationBar.m @@ -20,11 +20,11 @@ - (instancetype)initWithFrame:(CGRect)frame self = [super initWithFrame:frame]; if (self) { - self.frame = (CGRect){0, 0, kScreenWidth, 64}; + self.frame = (CGRect){0, 0, kScreenWidth, UIView.sc_navigationBarHeight}; self.backgroundColor = kNavigationBarColor; - self.lineView = [[UIView alloc] initWithFrame:(CGRect){0, 64, kScreenWidth, 0.5}]; + self.lineView = [[UIView alloc] initWithFrame:(CGRect){0, UIView.sc_navigationBarHeight, kScreenWidth, 0.5}]; self.lineView.backgroundColor = kNavigationBarLineColor; [self addSubview:self.lineView]; diff --git a/v2ex-iOS/Additions/SCPullRefresh/SCPullRefreshViewController.m b/v2ex-iOS/Additions/SCPullRefresh/SCPullRefreshViewController.m index 7527749..17b65ad 100644 --- a/v2ex-iOS/Additions/SCPullRefresh/SCPullRefreshViewController.m +++ b/v2ex-iOS/Additions/SCPullRefresh/SCPullRefreshViewController.m @@ -42,8 +42,8 @@ - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil _viewShowing = NO; _hiddenEnabled = NO; - self.tableViewInsertTop = 64; - self.tableViewInsertBottom = 0; + self.tableViewInsertTop = UIView.sc_navigationBarHeight; + self.tableViewInsertBottom = UIView.sc_bottomInset; } return self; @@ -61,7 +61,6 @@ - (void)loadView { self.loadMoreView = [[SCAnimationView alloc] initWithFrame:(CGRect){0, 0, kScreenWidth, 44}]; self.loadMoreView.timeOffset = 0.0; [self.tableFooterView addSubview:self.loadMoreView]; - } - (void)viewDidLoad @@ -70,6 +69,10 @@ - (void)viewDidLoad self.view.backgroundColor = kBackgroundColorWhiteDark; + if (@available(iOS 11.0, *)) { + self.tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever; + } + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didReceiveThemeChangeNotification) name:kThemeDidChangeNotification object:nil]; } diff --git a/v2ex-iOS/Controllers/V2CategoriesViewController.m b/v2ex-iOS/Controllers/V2CategoriesViewController.m index 1fd6d62..3b5c54f 100644 --- a/v2ex-iOS/Controllers/V2CategoriesViewController.m +++ b/v2ex-iOS/Controllers/V2CategoriesViewController.m @@ -247,7 +247,7 @@ - (void)configureTableView { self.tableView = [[UITableView alloc] initWithFrame:self.view.frame]; self.tableView.backgroundColor = kBackgroundColorWhiteDark; self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone; - self.tableView.contentInsetTop = 64; // Notice + self.tableView.contentInsetTop = UIView.sc_navigationBarHeight; // Notice self.tableView.delegate = self; self.tableView.dataSource = self; [self.view addSubview:self.tableView]; @@ -305,7 +305,10 @@ - (void)configureGestures { } else if (recognizer.state == UIGestureRecognizerStateChanged) { - [self setMenuOffset: - self.sectionView.width * progress]; +// [self setMenuOffset: - self.sectionView.width * progress]; + if (self.aboveTableViewButton.hidden) { + [self setMenuOffset: - self.sectionView.width * progress]; + } } else if (recognizer.state == UIGestureRecognizerStateEnded || recognizer.state == UIGestureRecognizerStateCancelled) { diff --git a/v2ex-iOS/Controllers/V2NodeViewController.m b/v2ex-iOS/Controllers/V2NodeViewController.m index 6297644..1e56be0 100644 --- a/v2ex-iOS/Controllers/V2NodeViewController.m +++ b/v2ex-iOS/Controllers/V2NodeViewController.m @@ -172,7 +172,7 @@ - (void)configureMenuView { self.menuView = [[UIView alloc] init]; self.menuView.alpha = 0.0; - self.menuView.frame = (CGRect){200, 64, 130, 118}; + self.menuView.frame = (CGRect){200, UIView.sc_navigationBarHeight, 130, 118}; [self.menuContainView addSubview:self.menuView]; UIView *topArrowView = [[UIView alloc] init]; diff --git a/v2ex-iOS/Controllers/V2ProfileViewController.m b/v2ex-iOS/Controllers/V2ProfileViewController.m index 06bbcb7..8d815df 100644 --- a/v2ex-iOS/Controllers/V2ProfileViewController.m +++ b/v2ex-iOS/Controllers/V2ProfileViewController.m @@ -133,7 +133,7 @@ - (void)viewDidAppear:(BOOL)animated { - (void)viewWillLayoutSubviews { [super viewWillLayoutSubviews]; - self.topPanel.frame = (CGRect){0, 64, kAvatarHeight + 10, kAvatarHeight + 10}; + self.topPanel.frame = (CGRect){0, UIView.sc_navigationBarHeight, kAvatarHeight + 10, kAvatarHeight + 10}; } @@ -423,7 +423,7 @@ - (void)setMember:(V2MemberModel *)member { - (void)scrollViewDidScroll:(UIScrollView *)scrollView { [super scrollViewDidScroll:scrollView]; - self.topPanel.y = - (self.tableView.contentInsetTop + scrollView.contentOffsetY) + 64; + self.topPanel.y = - (self.tableView.contentInsetTop + scrollView.contentOffsetY) + UIView.sc_navigationBarHeight; } diff --git a/v2ex-iOS/Controllers/V2RootViewController.m b/v2ex-iOS/Controllers/V2RootViewController.m index 7363ece..dcde6ba 100644 --- a/v2ex-iOS/Controllers/V2RootViewController.m +++ b/v2ex-iOS/Controllers/V2RootViewController.m @@ -9,6 +9,7 @@ #import "V2RootViewController.h" #import "SCNavigationController.h" +#import "UIView+SafeArea.h" #import "V2LatestViewController.h" #import "V2CategoriesViewController.h" @@ -92,8 +93,6 @@ - (void)viewDidLoad // NSFontAttributeName:[UIFont systemFontOfSize:17]}; self.edgesForExtendedLayout = UIRectEdgeAll; self.automaticallyAdjustsScrollViewInsets = NO; - - } #pragma mark - Life Cycle @@ -111,6 +110,10 @@ - (void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; // [self setBlurredScreenShoot]; + + NSLog(@"status: %.f", UIView.sc_statusBarHeight); + NSLog(@"navi: %.f", UIView.sc_navigationBarHeight); + NSLog(@"naviEx: %.f", UIView.sc_navigationBarHeighExcludeStatusBar); } - (void)dealloc{ diff --git a/v2ex-iOS/Controllers/V2SettingViewController.m b/v2ex-iOS/Controllers/V2SettingViewController.m index 180b5dd..75dca6c 100644 --- a/v2ex-iOS/Controllers/V2SettingViewController.m +++ b/v2ex-iOS/Controllers/V2SettingViewController.m @@ -78,7 +78,7 @@ - (void)didReceiveMemoryWarning - (void)viewWillLayoutSubviews { [super viewWillLayoutSubviews]; - self.tableView.contentInsetTop = 64; + self.tableView.contentInsetTop = UIView.sc_navigationBarHeight; self.tableView.contentInsetBottom = 15; } diff --git a/v2ex-iOS/Controllers/V2TopicCreateViewController.m b/v2ex-iOS/Controllers/V2TopicCreateViewController.m index 6826c1b..507ae5f 100644 --- a/v2ex-iOS/Controllers/V2TopicCreateViewController.m +++ b/v2ex-iOS/Controllers/V2TopicCreateViewController.m @@ -207,7 +207,7 @@ - (void)configureTextViews { // layout - self.contentPanel.frame = (CGRect){0, 0 + 64, kScreenWidth, kScreenHeight - kKeyboardHeightDefault - 64}; + self.contentPanel.frame = (CGRect){0, 0 + UIView.sc_navigationBarHeight, kScreenWidth, kScreenHeight - kKeyboardHeightDefault - UIView.sc_navigationBarHeight}; self.titleTextField.frame = (CGRect){12, 0, kScreenWidth - 24, kTitleHeight}; self.contentTextView.frame = (CGRect){8, kTitleHeight, kScreenWidth - 16, 0}; self.contentTextView.height = self.contentPanel.height - kTitleHeight - 10; diff --git a/v2ex-iOS/Controllers/V2TopicViewController.m b/v2ex-iOS/Controllers/V2TopicViewController.m index 07bd7e5..4cc160e 100644 --- a/v2ex-iOS/Controllers/V2TopicViewController.m +++ b/v2ex-iOS/Controllers/V2TopicViewController.m @@ -122,7 +122,7 @@ - (void)viewDidLoad if (self.isPreview) { [self createNavigationBar]; self.sc_navigationItem.title = @"预览"; - self.sc_navigationItem.titleLabel.centerY = 64/2; + self.sc_navigationItem.titleLabel.centerY = UIView.sc_statusBarHeight + UIView.sc_navigationBarHeighExcludeStatusBar/2; } else { self.sc_navigationItem.leftBarButtonItem = self.leftBarItem; self.sc_navigationItem.rightBarButtonItem = self.addBarItem; @@ -206,7 +206,7 @@ - (void)setPreview:(BOOL)preview { if (self.isPreview) { [self createNavigationBar]; self.sc_navigationItem.title = @"预览"; - self.sc_navigationItem.titleLabel.centerY = 64/2; + self.sc_navigationItem.titleLabel.centerY = UIView.sc_statusBarHeight + UIView.sc_navigationBarHeighExcludeStatusBar/2; } else { self.sc_navigationItem.leftBarButtonItem = self.leftBarItem; self.sc_navigationItem.rightBarButtonItem = self.addBarItem; @@ -229,7 +229,7 @@ - (void)viewWillLayoutSubviews { self.tableView.backgroundColor = kBackgroundColorWhite; self.hiddenEnabled = YES; - self.tableView.contentInsetTop = 64 - 36; + self.tableView.contentInsetTop = UIView.sc_navigationBarHeight - 36; self.menuContainView.frame = self.view.bounds; self.menuBackgroundButton.frame = self.menuContainView.bounds; @@ -828,20 +828,20 @@ - (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView { - (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate { [super scrollViewDidEndDragging:scrollView willDecelerate:decelerate]; - if (scrollView.contentOffsetY < - 64 + 36) { + if (scrollView.contentOffsetY < - UIView.sc_navigationBarHeight + 36) { self.isDragging = YES; [UIView animateWithDuration:0.3 animations:^{ - self.tableView.contentInsetTop = 64; + self.tableView.contentInsetTop = UIView.sc_navigationBarHeight; } completion:^(BOOL finished) { if (!decelerate) { [UIView animateWithDuration:0.3 animations:^{ - self.tableView.contentInsetTop = 64 - 36; + self.tableView.contentInsetTop = UIView.sc_navigationBarHeight - 36; }]; } }]; } else { self.isDragging = NO; - self.tableView.contentInsetTop = 64 - 36; + self.tableView.contentInsetTop = UIView.sc_navigationBarHeight - 36; } } @@ -1350,14 +1350,14 @@ - (void)showMenuAnimated:(BOOL)animated { [UIView animateWithDuration:0.3 animations:^{ self.menuView.alpha = 1.0; self.menuView.transform = CGAffineTransformIdentity; - self.menuView.frame = (CGRect){200, 64, 130, 118}; + self.menuView.frame = (CGRect){200, UIView.sc_navigationBarHeight, 130, 118}; } completion:^(BOOL finished) { self.menuContainView.userInteractionEnabled = YES; }]; } else { self.menuView.alpha = 1.0; self.menuView.transform = CGAffineTransformIdentity; - self.menuView.frame = (CGRect){200, 64, 130, 118}; + self.menuView.frame = (CGRect){200, UIView.sc_navigationBarHeight, 130, 118}; self.menuContainView.userInteractionEnabled = YES; } @@ -1375,11 +1375,11 @@ - (void)hideMenuAnimated:(BOOL)animated { [UIView animateWithDuration:0.3 animations:^{ self.menuView.transform = CGAffineTransformMakeScale(0.3, 0.3); - self.menuView.origin = (CGPoint){260, 64}; + self.menuView.origin = (CGPoint){260, UIView.sc_navigationBarHeight}; } completion:^(BOOL finished) { self.menuView.transform = CGAffineTransformIdentity; - self.menuView.frame = (CGRect){200, 64, 130, 118}; + self.menuView.frame = (CGRect){200, UIView.sc_navigationBarHeight, 130, 118}; self.isMenuShowing = NO; self.edgePanRecognizer.enabled = YES; }]; diff --git a/v2ex-iOS/Controllers/V2WebViewController.m b/v2ex-iOS/Controllers/V2WebViewController.m index 642b8b1..c200557 100644 --- a/v2ex-iOS/Controllers/V2WebViewController.m +++ b/v2ex-iOS/Controllers/V2WebViewController.m @@ -94,9 +94,9 @@ - (void)viewWillLayoutSubviews { [super viewWillLayoutSubviews]; CGRect rect = self.view.bounds; - self.webView.frame = (CGRect){0, 44, kScreenWidth, kScreenHeight - 44}; + self.webView.frame = (CGRect){0, UIView.sc_navigationBarHeight, kScreenWidth, kScreenHeight - (44 + UIView.sc_bottomInset)}; - self.toolBar.frame = CGRectMake(0, rect.size.height-44, rect.size.width, 44); + self.toolBar.frame = CGRectMake(0, rect.size.height - (44 + UIView.sc_bottomInset), rect.size.width, (44 + UIView.sc_bottomInset)); self.prevButton.frame = CGRectMake(15, 12, 20, 20); self.refreshButton.frame = CGRectMake(kScreenWidth/2 - 10, 12, 20, 20); self.nextButton.frame = CGRectMake(kScreenWidth - 35, 12, 20, 20); @@ -234,7 +234,7 @@ - (void)configureWebView { } if (webScrollView) { - webScrollView.contentInset = UIEdgeInsetsMake(0.0f, 0.0f, 44.0f, 0); + webScrollView.contentInset = UIEdgeInsetsMake(0.0f, 0.0f, UIView.sc_navigationBarHeight, 0); } } diff --git a/v2ex-iOS/Controllers/V2WeiboViewController.m b/v2ex-iOS/Controllers/V2WeiboViewController.m index 25a7ac3..af73a6d 100644 --- a/v2ex-iOS/Controllers/V2WeiboViewController.m +++ b/v2ex-iOS/Controllers/V2WeiboViewController.m @@ -78,7 +78,7 @@ - (void)configureBarItems { - (void)configureWebView { - self.webView = [[UIWebView alloc] initWithFrame:(CGRect){0, 44, kScreenWidth, kScreenHeight - 64}]; + self.webView = [[UIWebView alloc] initWithFrame:(CGRect){0, UIView.sc_navigationBarHeight, kScreenWidth, kScreenHeight - 64}]; self.webView.delegate = self; [self.view addSubview:self.webView]; diff --git a/v2ex-iOS/Images.xcassets/AppIcon.appiconset/Contents.json b/v2ex-iOS/Images.xcassets/AppIcon.appiconset/Contents.json index 0289e02..4816e4a 100644 --- a/v2ex-iOS/Images.xcassets/AppIcon.appiconset/Contents.json +++ b/v2ex-iOS/Images.xcassets/AppIcon.appiconset/Contents.json @@ -1,5 +1,15 @@ { "images" : [ + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "3x" + }, { "size" : "29x29", "idiom" : "iphone", @@ -36,6 +46,16 @@ "filename" : "icon-60@3x.png", "scale" : "3x" }, + { + "idiom" : "ipad", + "size" : "20x20", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "20x20", + "scale" : "2x" + }, { "size" : "29x29", "idiom" : "ipad", @@ -77,6 +97,11 @@ "idiom" : "ipad", "filename" : "icon-83.5@2x.png", "scale" : "2x" + }, + { + "idiom" : "ios-marketing", + "size" : "1024x1024", + "scale" : "1x" } ], "info" : { diff --git a/v2ex-iOS/Images.xcassets/Contents.json b/v2ex-iOS/Images.xcassets/Contents.json new file mode 100644 index 0000000..da4a164 --- /dev/null +++ b/v2ex-iOS/Images.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/v2ex-iOS/Images.xcassets/LaunchImage.launchimage/Contents.json b/v2ex-iOS/Images.xcassets/LaunchImage.launchimage/Contents.json index 94b772f..b4184bb 100644 --- a/v2ex-iOS/Images.xcassets/LaunchImage.launchimage/Contents.json +++ b/v2ex-iOS/Images.xcassets/LaunchImage.launchimage/Contents.json @@ -1,5 +1,14 @@ { "images" : [ + { + "extent" : "full-screen", + "idiom" : "iphone", + "subtype" : "2436h", + "filename" : "Default-1218h@2x.png", + "minimum-system-version" : "11.0", + "orientation" : "portrait", + "scale" : "3x" + }, { "extent" : "full-screen", "idiom" : "iphone", @@ -21,9 +30,9 @@ { "orientation" : "portrait", "idiom" : "iphone", + "filename" : "Default@2x.png", "extent" : "full-screen", "minimum-system-version" : "7.0", - "filename" : "Default@2x.png", "scale" : "2x" }, { @@ -38,17 +47,17 @@ { "orientation" : "portrait", "idiom" : "ipad", + "filename" : "Default-1024h.png", "extent" : "full-screen", "minimum-system-version" : "7.0", - "filename" : "Default-1024h.png", "scale" : "1x" }, { "orientation" : "portrait", "idiom" : "ipad", + "filename" : "Default-1024h@2x.png", "extent" : "full-screen", "minimum-system-version" : "7.0", - "filename" : "Default-1024h@2x.png", "scale" : "2x" } ], diff --git a/v2ex-iOS/Images.xcassets/LaunchImage.launchimage/Default-1218h@2x.png b/v2ex-iOS/Images.xcassets/LaunchImage.launchimage/Default-1218h@2x.png new file mode 100644 index 0000000..0a49428 Binary files /dev/null and b/v2ex-iOS/Images.xcassets/LaunchImage.launchimage/Default-1218h@2x.png differ diff --git a/v2ex-iOS/Models/V2NotificationModel.m b/v2ex-iOS/Models/V2NotificationModel.m index 7d2e196..0b45ae8 100644 --- a/v2ex-iOS/Models/V2NotificationModel.m +++ b/v2ex-iOS/Models/V2NotificationModel.m @@ -207,4 +207,4 @@ + (V2NotificationList *)getNotificationFromResponseObject:(id)responseObject { return list; } -@end \ No newline at end of file +@end diff --git a/v2ex-iOS/V2AppDelegate.m b/v2ex-iOS/V2AppDelegate.m index db32dd8..a8fea09 100644 --- a/v2ex-iOS/V2AppDelegate.m +++ b/v2ex-iOS/V2AppDelegate.m @@ -51,11 +51,11 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:( self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; self.window.backgroundColor = [UIColor whiteColor]; + [self.window makeKeyAndVisible]; self.rootViewController = [[V2RootViewController alloc] init]; self.window.rootViewController = self.rootViewController; - [self.window makeKeyAndVisible]; [Fabric with:@[CrashlyticsKit]]; diff --git a/v2ex-iOS/Views/V2MenuSectionView.m b/v2ex-iOS/Views/V2MenuSectionView.m index 40de9e6..5df610d 100644 --- a/v2ex-iOS/Views/V2MenuSectionView.m +++ b/v2ex-iOS/Views/V2MenuSectionView.m @@ -66,8 +66,7 @@ - (void)configureTableView { self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone; self.tableView.delegate = self; self.tableView.dataSource = self; -// self.tableView.contentInsetTop = (kScreenHeight - 44 * self.sectionTitleArray.count) / 2; - self.tableView.contentInsetTop = 120; + self.tableView.contentInsetTop = 100 + UIView.sc_statusBarHeight; [self addSubview:self.tableView]; } @@ -167,11 +166,9 @@ - (void)configureNotifications { - (void)layoutSubviews { -// CGFloat spaceHeight = (self.tableView.contentInsetTop - kAvatarHeight) / 3.0; - self.avatarImageView.frame = (CGRect){30, 30, kAvatarHeight, kAvatarHeight}; + self.avatarImageView.frame = (CGRect){30, 10 + UIView.sc_statusBarHeight, kAvatarHeight, kAvatarHeight}; self.avatarButton.frame = self.avatarImageView.frame; -// self.divideImageView.frame = (CGRect){80, kAvatarHeight + 50, 80, 0.5}; - self.divideImageView.frame = (CGRect){-self.width, kAvatarHeight + 50, self.width * 2, 0.5}; + self.divideImageView.frame = (CGRect){-self.width, kAvatarHeight + 30 + UIView.sc_statusBarHeight, self.width * 2, 0.5}; self.tableView.frame = (CGRect){0, 0, self.width, self.height}; [self.tableView selectRowAtIndexPath:[NSIndexPath indexPathForRow:[V2SettingManager manager].selectedSectionIndex inSection:0] animated:NO scrollPosition:UITableViewScrollPositionNone]; diff --git a/v2ex-iOS/Views/V2TopicToolBarView.m b/v2ex-iOS/Views/V2TopicToolBarView.m index 9c5fb0c..5fa0b37 100644 --- a/v2ex-iOS/Views/V2TopicToolBarView.m +++ b/v2ex-iOS/Views/V2TopicToolBarView.m @@ -378,7 +378,7 @@ - (void)showReplyViewWithQuotes:(NSArray *)quotes animated:(BOOL)animated { [UIView animateWithDuration:0.8 delay:0 usingSpringWithDamping:0.75 initialSpringVelocity:0.95 options:UIViewAnimationOptionCurveEaseIn animations:^{ // self.backgroundImageView.alpha = 1; - self.textView.y = 74; + self.textView.y = UIView.sc_navigationBarHeight + 10; } completion:^(BOOL finished) { self.imageInsertButton.centerY = (kScreenHeight - self.keyboardHeight - self.textView.y - self.textView.height) / 2 + self.textView.y + self.textView.height; }]; @@ -400,7 +400,7 @@ - (void)showReplyViewWithQuotes:(NSArray *)quotes animated:(BOOL)animated { [self.textView becomeFirstResponder]; - self.textView.y = 74; + self.textView.y = UIView.sc_navigationBarHeight + 10; self.imageInsertButton.centerY = (kScreenHeight - self.keyboardHeight - self.textView.y - self.textView.height) / 2 + self.textView.y + self.textView.height; @@ -495,7 +495,7 @@ - (void)hideToolBar { if (self.textView.y > 0) { [UIView animateWithDuration:0.1 animations:^{ - self.textView.y = 84; + self.textView.y = UIView.sc_navigationBarHeight + 20; } completion:^(BOOL finished) { [UIView animateWithDuration:0.7 delay:0 usingSpringWithDamping:0.8 initialSpringVelocity:1.05 options:UIViewAnimationOptionCurveEaseOut animations:^{ self.textView.y = -self.textView.height; diff --git a/v2ex-iOS/v2ex-iOS-Prefix.pch b/v2ex-iOS/v2ex-iOS-Prefix.pch index 21452d5..60b93c0 100644 --- a/v2ex-iOS/v2ex-iOS-Prefix.pch +++ b/v2ex-iOS/v2ex-iOS-Prefix.pch @@ -21,10 +21,10 @@ #import #import #import -// #import #import "NSDictionary+NotNullKey.h" #import "EXTScope.h" #import "UIImage+Tint.h" + #import "UIView+SafeArea.h" #import "SCNavigation.h" #import "SCActionSheet.h"