摘要:第一个是initWithCoder方法:因为开发者多在Storyboard中使用Autolayout,而Storyboard中的View初始化不是使用常见的initWithFrame方法的,而是使用initWithCoder方法来初始化View。因此自定义控件有初始化逻辑的话(如设置变量默认值什么的...
阅读全文
摘要://方法一NSString *appDomain = [[NSBundle mainBundle] bundleIdentifier];[[NSUserDefaults standardUserDefaults] removePersistentDomainForName:appDomain]; /...
阅读全文
摘要:1 - (BOOL)validateMobile:(NSString *)mobileNum 2 { 3 /** 4 * 手机号码 5 * 移动:134[0-8],135,136,137,138,139,150,151,157,158,159,182,187...
阅读全文
摘要:这几天做登录的接口是,登录老是失败,提示"系统异常,请请联系管理员",找了半天问题,最后发现POST的请求体中"+"都被替换为" ",简直坑爹啊,在这里提供下解决方法。//URLEncode+(NSString*)encodeString:(NSString*)unencodedString{ ...
阅读全文
摘要:获取本地时间戳1 // 获取时间戳2 NSDate* dat = [NSDate dateWithTimeIntervalSinceNow:0];3 NSTimeInterval a=[dat timeIntervalSince1970];4 NSString *ti...
阅读全文
摘要:1、调用 自带mail[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"mailto://admin@hzlzh.com"]];2、调用 电话phone[[UIApplication sharedApplication...
阅读全文
摘要:Objective C中的写法TwoViewController *v = [[TwoViewController alloc] init]; //这样会把TwoViewController默认关联到TwoViewController.xib上//等同调用了方法TwoViewController *...
阅读全文
摘要:1,Command+N,打开新建文件窗口:ios->other->PCH file,创建一个pch文件:“工程名-Prefix.pch”:2,将building setting中的precompile header选项的路径添加“$(SRCROOT)/项目名称/pch文件名”(例如:$(SRCROO...
阅读全文
摘要:今天使用AFN框架时出现了以下错误提示信息Error Domain=com.alamofire.error.serialization.response Code=-1016 "Request failed: unacceptable content-type: text/html"经过百度,发现原...
阅读全文