三十八:各個版本ipHONE分辨率及圖片的實現(xiàn)原理
desert@2x : iPhone 4s (320 x 420)desert-568h@2x : iPhones 5, 5C and 5S (320 x 568)desert-667h@2x : iPhone 6 (375 x 667)desert-736h@3x : iPhone 6+ (414 x 736)desert@2x~ipad : iPad (1024 x 768)
iPhone 4S Screen Size: 3.5 Inches Resolution: 640 x 960 (Half: 320 x 480)
iPhone 5 Screen Size: 4.0 Inches Resolution: 640 × 1136 (Half: 320 x 568)
iPhone 5S/5C Screen Size: 4.0 Inches Resolution: 640 x 1136 (Half: 320 x 568)
iPhone 6 Screen Size: 4.7 Inches Resolution: 750 x 1334 (Half: 375 x 667)
iPhone 6 Plus Screen Size: 5.5 Inches Resolution: 1242 x 2208 (1/3: 414 x 736) The size of iPhone 6 Plus is @3x scaling. So, it is divided by 3.
界面大小比例:
圖片大小實現(xiàn)的原理:
#import <UIKit/UIKit.h>typedef NS_ENUM(NSInteger, thisDeviceClass) { thisDeviceClass_iPhone, thisDeviceClass_iPhoneRetina, thisDeviceClass_iPhone5, thisDeviceClass_iPhone6, thisDeviceClass_iPhone6plus, // we can add new devices when we become aware of them thisDeviceClass_iPad, thisDeviceClass_iPadRetina, thisDeviceClass_unknown};thisDeviceClass currentDeviceClass();@interface UIImage (DeviceSpecificMedia)+ (instancetype )imageForDeviceWithName:(NSString *)fileName;@end
#import "UIImage+DeviceSpecificMedia.h"thisDeviceClass currentDeviceClass() { CGFloat greaterPixelDimension = (CGFloat) fmaxf(((float)[[UIScreen mainScreen]bounds].size.height), ((float)[[UIScreen mainScreen]bounds].size.width)); switch ((NSInteger)greaterPixelDimension) { case 480: return (( [[UIScreen mainScreen]scale] > 1.0) ? thisDeviceClass_iPhoneRetina : thisDeviceClass_iPhone ); break; case 568: return thisDeviceClass_iPhone5; break; case 667: return thisDeviceClass_iPhone6; break; case 736: return thisDeviceClass_iPhone6plus; break; case 1024: return (( [[UIScreen mainScreen]scale] > 1.0) ? thisDeviceClass_iPadRetina : thisDeviceClass_iPad ); break; default: return thisDeviceClass_unknown; break; }}@implementation UIImage (deviceSpecificMedia)+ (NSString *)magicSuffixForDevice{ switch (currentDeviceClass()) { case thisDeviceClass_iPhone: return @""; break; case thisDeviceClass_iPhoneRetina: return @"@2x"; break; case thisDeviceClass_iPhone5: return @"-568h@2x"; break; case thisDeviceClass_iPhone6: return @"-667h@2x"; //or some other arbitrary string.. break; case thisDeviceClass_iPhone6plus: return @"-736h@3x"; break; case thisDeviceClass_iPad: return @"~ipad"; break; case thisDeviceClass_iPadRetina: return @"~ipad@2x"; break; case thisDeviceClass_unknown: default: return @""; break; }}+ (instancetype )imageForDeviceWithName:(NSString *)fileName{ UIImage *result = nil; NSString *nameWithSuffix = [fileName stringByAppendingString:[UIImage magicSuffixForDevice]]; result = [UIImage imageNamed:nameWithSuffix]; if (!result) { result = [UIImage imageNamed:fileName]; } return result;}@end
三十九:其它幾張知識圖片
1:NSObject繼承類圖
2:sqlite3返回含義
3:視圖坐標說明
4:生命周期圖
5:UI繼承圖
6:Segue列表跳轉(zhuǎn),關(guān)于selection跟accessory的區(qū)別
7:IOS6與IOS7界頁的差別
四十:為什么XCode項目中會有A M這種標識
如果沒裝過svn,默認是本機 git管理。 M是表示改文件有改動,A是新增加的文件。目前是都沒有提交到服務(wù)器狀態(tài),到source control 里點選commit 提交后就沒這些了,下次再有改動或新增,還會出現(xiàn)該標記。
四十一:MAC 本地進行IP映射域名的操作
1.打開finder, 快捷鍵:shift+command+g 前往文件夾 “/etc”
2.找到hosts文件托到桌面修改,再把/etc下源文件刪除,把桌面修改好的拖進/etc。
最后在終端:ping svnserver ,如果能ping通到192.168.1.51,說明映射成功
四十二:arm64 armv7 armv7s arm6
目前ios的指令集有以下幾種:• armv6 ?
iPhone? iPhone2? iPhone3G? 第一代和第二代iPod Touch• armv7
? iPhone4? iPhone4S• armv7s
? iPhone5? iPhone5C• arm64
? iPhone5S 機器對指令集的支持是向下兼容的,因此armv7的指令集是可以運行在iphone5S的,只是效率沒那么高而已~================================================Architecture : 指你想支持的指令集。Valid architectures : 指即將編譯的指令集。Build Active Architecture Only : 只是否只編譯當前適用的指令集。================================================ 現(xiàn)在是2014年初,其實4和4S的用戶還是蠻多的,而iphone3之類的機器幾乎沒有了,所以我們的指令集最低必須基于armv7.因此,Architecture的值選擇:armv7 armv7s arm64PS:選arm64時需要最低支持5.1.1:
四十三:真機測試報 TCWeiboSDK 93 duplicate symbols for architecture armv7
這是因為在項目中引用的兩個相同的類庫引起了,在我的項目中是因為引入的兩個不同指令集引起的;
四十四:UINavigationBar的一些屬性的行為發(fā)生了變化
self.navigationController.navigationBar.barTintColor = [UIColor blackColor];self.navigationController.navigationBar.tintColor = [UIColor whiteColor];[self.navigationController.navigationBar setTitleTextAttributes:@{NSForegroundColorAttributeName : [UIColor whiteColor]}];self.navigationController.navigationBar.translucent = NO;
新聞熱點
疑難解答