码迷,mamicode.com
首页 > 移动开发 > 详细

IOS开发中常用一下方法

时间:2015-10-18 21:27:03      阅读:217      评论:0      收藏:0      [点我收藏+]

标签:

1.获得屏幕的宽高

  [UIScreen mainScreen].bounds.size.width

      [UIScreen mainScreen].bounds.size.height

2.Iphone版本判别:

  iPhone5 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640,1136), [[UIScreen mainScreen] currentMode].size) : NO)

  iPhone4 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640,960), [[UIScreen mainScreen] currentMode].size) : NO)

  Phone6 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(750,1334), [[UIScreen mainScreen] currentMode].size) : NO)

  iPhone6plus ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1242,2208), [[UIScreen mainScreen] currentMode].size) : NO)

3.Iphone、Ipad、Ipod判别:

  [UIDevice currentDevice].model

4.获得Documents路径:

  NSArray *array = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);

     NSString *path = [array lastObject];

5.获得mp路径:

  NSString *tmp = NSTemporaryDirectory();

IOS开发中常用一下方法

标签:

原文地址:http://www.cnblogs.com/small-octopus/p/4890287.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!