• iOS开发基础知识--碎片7


     

    iOS开发基础知识--碎片7 

    三十八:各个版本IPHONE分辨率及图片的实现原理

    复制代码
    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.

    复制代码

    界面大小比例:

    图片大小实现的原理:

    复制代码
    #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列表跳转,关于selection跟Accessory的区别

    7:IOS6与IOS7界页的差别

    四十:为什么XCode项目中会有A M这种标识

    如果没装过svn,默认是本机 git管理。 M是表示改文件有改动,A是新增加的文件。目前是都没有提交到服务器状态,到source control 里点选commit 提交后就没这些了,下次再有改动或新增,还会出现该标记。

    四十一: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 : 只是否只编译当前适用的指令集。 ================================================ 现在是2014年初,其实4和4S的用户还是蛮多的,而iphone3之类的机器几乎没有了,所以我们的指令集最低必须基于armv7. 因此,Architecture的值选择:armv7 armv7s arm64 PS:选arm64时需要最低支持5.1.1:
    复制代码

     四十三:真机测试报 TCWeiboSDK 93 duplicate symbols for architecture armv7

    这是因为在项目中引用的两个相同的类库引起了,在我的项目中是因为引入的两个不同指令集引起的;

    四十四:UINavigationBar的一些属性的行为发生了变化

    self.navigationController.navigationBar.barTintColor = [UIColor blackColor];
    self.navigationController.navigationBar.tintColor = [UIColor whiteColor];
    [self.navigationController.navigationBar setTitleTextAttributes:@{NSForegroundColorAttributeName : [UIColor whiteColor]}];
    self.navigationController.navigationBar.translucent = NO;
  • 相关阅读:
    自己定义九宫格手势解锁
    2015程序猴的总结:不破楼兰终不还!
    Codeforces Round #402 (Div. 2)
    [整体二分]【学习笔记】【更新中】
    BZOJ 3110: [Zjoi2013]K大数查询 [整体二分]
    BZOJ 2738: 矩阵乘法 [整体二分]
    BZOJ 2527: [Poi2011]Meteors [整体二分]
    [偏序关系与CDQ分治]【学习笔记】
    BZOJ 2244: [SDOI2011]拦截导弹 [CDQ分治 树状数组]
    COGS 2479. [HZOI 2016]偏序 [CDQ分治套CDQ分治 四维偏序]
  • 原文地址:https://www.cnblogs.com/LiLihongqiang/p/5786279.html
Copyright © 2020-2023  润新知