随笔分类 -  iOS

iOS 中的round、ceil、floor
摘要:roundf(float)、round(double)、roundl(long double) 如果是参数是小数,返回值为四舍五入后的整数 NSLog(@"%f - %f - %f",round(3.4),round(3.5),round(3.6)); 3.000000 - 4.000000 - 4 阅读全文

posted @ 2019-01-21 15:47 7890陈 阅读(910) 评论(0) 推荐(0)

iOS UILabel计算宽度和高度
摘要:1、根据文本计算size,这里需要传入attributes UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(20, 100, 0, 0)]; label.text = @"12331afaa我是谁的谁"; label.textCo 阅读全文

posted @ 2018-09-21 17:46 7890陈 阅读(351) 评论(0) 推荐(0)

iOS 常用的宏
摘要:/* 屏幕宽高 */ #define SCREEN_WIDTH ([[UIScreen mainScreen] bounds].size.width) #define SCREEN_HEIGHT ([[UIScreen mainScreen] bounds].size.height) /* 打印日志 阅读全文

posted @ 2018-09-20 10:07 7890陈 阅读(111) 评论(0) 推荐(0)

iOS 关联对象(Associated Object)
摘要:1、category需要添加属性,可以使用关联对象来扩展对象 objc_setAssociatedObject(id _Nonnull object, const void * _Nonnull key, id _Nullable value, objc_AssociationPolicy poli 阅读全文

posted @ 2018-09-19 17:02 7890陈 阅读(170) 评论(0) 推荐(0)

iOS 项目分组目录
摘要:1、BaseUI UI控件基类 (UINavgiationController、UITabBarViewController) 2、Config 项目配置库 一些URL、Color、Strings、Style等配置 3、NetRequest 网络请求类 4、Extension 扩展类 对原有类进行扩 阅读全文

posted @ 2018-08-02 14:36 7890陈 阅读(224) 评论(0) 推荐(0)

iOS 新建空工程
摘要:1、打开xcode,新建一个Single View App。项目名称:MyTest 2、创建成功后,删除这三个文件 ViewController.h ViewController.m Main.storyboard 3、删除info.plist中 Main storyboard file base 阅读全文

posted @ 2018-08-02 11:54 7890陈 阅读(177) 评论(0) 推荐(0)

iOS 消息转发
摘要:当我们调用一个不存在的方法时,就会报:unrecognized selector sent to instance **。消息接收者找不到对应的selector,这样就启动了消息转发机制,我们可以通过代码在消息转发的过程中告诉对象应该如何处理未知的消息,默认抛出上面的异常。 1、对象在收到未知消息后 阅读全文

posted @ 2018-07-12 15:25 7890陈 阅读(154) 评论(0) 推荐(0)

iOS 配置pch文件
摘要:Build Settings -> Apple LLVM 8.1-Language 目录下,找到下面两个标签进行设置 Prefix Header $(SRCROOT)/PrefixHeader.pch 或者 项目名/pch文件名.pch Precompile Predix Header YES 阅读全文

posted @ 2017-09-26 10:54 7890陈 阅读(126) 评论(0) 推荐(0)

iOS 去掉UISearchBar输入框上面的黑线
摘要:设置前后的效果图 [searchBar setBackGroundImage:[UIImage new]]; 阅读全文

posted @ 2017-09-25 14:15 7890陈 阅读(257) 评论(0) 推荐(0)

iOS 设置 AppIcon 和 LaunchImage
摘要:1、AppIcon 尺寸 iPhone Notification iOS 7-10 20pt 2x( 40x40 ) 3x( 60x60 ) iPhone、Spotlight iOS 5,6 、Settings iOS 5-10 29pt 2x( 58x58 ) 3x( 87x87 ) iPhone 阅读全文

posted @ 2017-08-14 11:56 7890陈 阅读(531) 评论(0) 推荐(0)

iOS面试题 耦合性
摘要:1、什么是耦合性? 耦合性( Coupling )也叫耦合度,是对模块间关联的度量。耦合的强弱取决于模块间接口的复杂性、调用模块的方式以及通过界面传达数据的多少,模块间的耦合度是指模块之间的依赖关系,包括控制关系、调用关系、数据传递关系。模块间联系越多,其耦合性越强,同时表面独立性越差。划分模块准则 阅读全文

posted @ 2017-07-11 09:13 7890陈 阅读(167) 评论(0) 推荐(0)

iOS 对UIImage进行的一些操作
摘要:1、生成指定宽高的UIImage对象(oldImage为原始图片对象,newImage为操作后的图片对象) 2、对UIImage进行裁剪 阅读全文

posted @ 2015-11-13 23:00 7890陈 阅读(360) 评论(0) 推荐(0)

导航