![](https://img-blog.csdnimg.cn/20210730231941967.jpeg?x-oss-process=image/resize,m_fixed,h_224,w_224)
Object-C
Object-C
EugeneLaw
full stack developer
展开
-
我最喜欢用的代码块 BLOCK
在iOS中有代理回调、通知、代码块等传递响应链的方式,代理和通知我总觉得麻烦,而BLOCK的用法却经常让我有一种莫名的爽感。 BLOCK在成员属性中可以这样定义:@property (nonatomic, copy) <#void#>(^<#block name#>)(<#param...#>); 格式是:@property(nona...原创 2018-07-20 09:36:02 · 132 阅读 · 0 评论 -
AFNetworking 发送 raw 格式的 post 请求
NSMutableDictionary *params = [[NSMutableDictionary alloc] initWithDictionary:rawParams]; NSData *data = [NSJSONSerialization dataWithJSONObject:params options:NSJSONWritingPrettyPrinted err...原创 2018-07-20 11:48:43 · 6155 阅读 · 0 评论 -
AFNetworking 怎么解析非 json 的 字符串 返回数据
在其源码里面增加代码,位置为:AFN>Serialization>AFURLResponseSerialization.m>-responseObjectForResponse:data:error:#pragma mark - AFURLResponseSerialization- (id)responseObjectForResponse:(NSURLRespo...原创 2018-07-20 11:53:23 · 1688 阅读 · 0 评论 -
Category 添加 成员属性
Category分类可以给已有类进行扩展,主要用于方法函数的补充,却不能补充成员属性。但是可以使用RunTime机制给它加“成员属性”,使用起来很方便哦!>头文件#import <UIKit/UIKit.h>@interface UIButton (UserInfo)@property (nonatomic, retain) NSDictionary *userI...原创 2018-07-20 12:02:02 · 142 阅读 · 0 评论 -
利用RunTime拦截Alert
- (void)viewDidLoad { [super viewDidLoad];// Do any additional setup after loading the view, typically from a nib. [self runtimeReplaceAlert];} // 利用runtime来替换展现弹出框的方法- (void)runtimeR...原创 2018-07-20 13:40:27 · 186 阅读 · 0 评论 -
iOS的生命周期
应用入口 应用从main函数开始,首先设置的是Appdelegate代理。 应用加载完成[AppDelegate application:didFinishLaunchingWithOptions:] window被创建 应用激活[AppDelegate applicationDidBecomeActive:] 返回手机主页面时,程序生命周期停止[Ap...原创 2018-07-21 11:13:57 · 138 阅读 · 0 评论 -
iOS APP 启动时间优化
附:控制台输出预启动时间logTotal pre-main time: 246.58 milliseconds (100.0%) dylib loading time: 72.98 milliseconds (29.5%) rebase/binding time: 51.10 milliseconds (20.7%) Ob...原创 2018-07-24 10:06:19 · 560 阅读 · 0 评论 -
iOS消除第三方SDK警告
在platform :ios, ‘xx’后面加入:inhibit_all_warnings!再重新install即可。原创 2018-07-23 15:46:34 · 520 阅读 · 0 评论