01 2016 档案
iOS 判断邮箱格式是否正确的代码
摘要:-(BOOL)isValidateEmail:(NSString *)email { NSString *emailRegex = @"[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,4}"; NSPredicate *emailTest = [NSPre 阅读全文
posted @ 2016-01-28 09:23 i兮兮 阅读(309) 评论(0) 推荐(0)
IOS 记录用户登陆状态
摘要:今天要说的是如何记录我们用户的登陆状态。例如微信,QQ等,在用户登陆后,关闭应用在打开就直接登陆了。那么我们在App开发中如何记录用户的登 陆状态呢?之前在用PHP或者Java写B/S结构的东西的时候,我们用Session来存储用户的登陆信息,Session是存在服务器上仅在一次回话 中有效,如果要 阅读全文
posted @ 2016-01-27 15:39 i兮兮 阅读(401) 评论(0) 推荐(0)
ios 软键盘的相关处理
摘要:1.触摸键盘以外的屏幕回收键盘 //回收键盘- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{ [self.view endEditing:YES];} 2.点击软键盘上完成按钮回收键盘 *在.m中签订协议<UIText 阅读全文
posted @ 2016-01-27 15:34 i兮兮 阅读(264) 评论(0) 推荐(0)
iOS 点击tabbarItem的时候根据登录状态判断加载哪个视图控制器
摘要:项目里面在点击tabbarItem的时候需要判断是否是登录状态,如果未登录直接跳转登录页面,如果已登录则直接进入。具体做法是:1:在持有TabbarController的类中, 注入代理UITabbarControllerDelegate2:TableBarController *tabBarC =... 阅读全文
posted @ 2016-01-27 14:18 i兮兮 阅读(724) 评论(0) 推荐(0)
iOS 关于TabviewController的那些事儿~
摘要:1:如果想让tabview可以滑动,cell不相应用户的点击。需要在- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { ExpenseVi... 阅读全文
posted @ 2016-01-26 11:42 i兮兮 阅读(385) 评论(0) 推荐(0)
ios 将时间戳转为时间类型
摘要:NSString *dataStr = @"1453709220"; double lastactivityInterval = [model.addtime doubleValue]; NSDateFormatter* formatter = [[NSDateFormatter alloc... 阅读全文
posted @ 2016-01-26 11:34 i兮兮 阅读(414) 评论(0) 推荐(0)
iOS 从网络获取json数据的系统方法
摘要:iOS 从网络获取son并解析NSString* GXURL = PURL;GXURL = [GXURL stringByAppendingString:@"/index.php/Api/android_getRankByShow/eid/521"],GXURL;NSURL* url = [NSUR... 阅读全文
posted @ 2016-01-26 10:01 i兮兮 阅读(787) 评论(0) 推荐(0)
ios 获取当前时间
摘要://获取当前日期 NSDate* date = [NSDate date]; NSDateFormatter* dateFormat = [[NSDateFormatter alloc] init]; [date... 阅读全文
posted @ 2016-01-26 10:00 i兮兮 阅读(403) 评论(0) 推荐(0)
UICollectionViewController既有headerView又有footerView。
摘要:#import "FirstHeaderReusableView.h"#import "FirstFooterReusableView.h"#define ITEMWIDTH ([UIScreen mainScreen].bounds.size.width - 30) / 2#define ITEM... 阅读全文
posted @ 2016-01-25 08:37 i兮兮 阅读(355) 评论(0) 推荐(0)
iOS App设置icon,启动图,App名称的方法
摘要:每款App都要有自己的icon,和名称。需要的话还需要设置启动图。今天我们就来说一下如何设置这些。本篇博客暂不讨论关于尺寸的问题。icon:icon的设置还是很简单的根据上图的箭头和红框标记所示,首先在工程中选中“images”,然后选择“AppIcon”,把预先准备好的各个尺寸的icon拖到相应的... 阅读全文
posted @ 2016-01-23 16:47 i兮兮 阅读(1534) 评论(0) 推荐(0)
iOS UIScrollview 和侧滑手势冲突解决方法
摘要:在自定义的uiscroview里添加方法。左边侧滑:- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer{CGPoint velocity = [(UIPanGestureRecognizer *)... 阅读全文
posted @ 2016-01-19 16:28 i兮兮 阅读(3248) 评论(0) 推荐(0)
错误代码: Could not load the "XXX.png" image referenced from a nib in the bundle with identifier "XXX"
摘要:出现该问题的原因是没有将相应地图片文件copy到bundle里,解决办法很简单,点击项目名称,选择Build Phase,找到Copy Bundle Resources,点击“+”,将相应的资源文件添加即可。 阅读全文
posted @ 2016-01-18 08:48 i兮兮 阅读(1100) 评论(0) 推荐(0)
错误代码:No architectures to compile for (ONLY_ACTIVE_ARCH=YES, active arch=arm64, VALID_ARCHS=armv7 armv7s).
摘要:错误代码:No architectures to compile for (ONLY_ACTIVE_ARCH=YES, active arch=arm64, VALID_ARCHS=armv7 armv7s). 阅读全文
posted @ 2016-01-15 09:08 i兮兮 阅读(602) 评论(0) 推荐(0)
错误代码:Your build settings specify a provisioning profile with the UUID “”, however, no such provisioning profile was found
摘要:在Archive项目时,出现了“Your build settings specify a provisioning profile with the UUID “”, however, no such provisioning profile was found”的出错。一直提示指定UUID的pr... 阅读全文
posted @ 2016-01-15 09:06 i兮兮 阅读(242) 评论(0) 推荐(0)
ios url 编码和解码
摘要:1.url编码ios中http请求遇到汉字的时候,需要转化成UTF-8,用到的方法是:NSString * encodingString = [urlString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];2.ur... 阅读全文
posted @ 2016-01-14 16:03 i兮兮 阅读(163) 评论(0) 推荐(0)
使用 NSUserDefaults 存储自定义对象
摘要:!!!当在实际开发过程中,因为存在其它服务端比如PC端,安卓端进行资料的修改的情况,app的资料显示要求实时更新,所以在做自动登录持久化存储用户信息的时候,最好直接用NSString保存用户的ID等有用的信息,在需要显示用户资料的时候重新请求服务器,用NSUserDefaults存储用户对象的做法不... 阅读全文
posted @ 2016-01-13 14:12 i兮兮 阅读(280) 评论(0) 推荐(0)
在xib/storyboard里面设置view圆角半径
摘要:想给视图设置圆角,常用的做法是将IB中的控件拖线到控制器,然后设置其圆角半径,以UIImageView为例,默认的UIImageView是矩形:未处理的ImageView我们想将这个imageView裁成一个圆形的头像,使用代码的设置方法如下:self.imageView.layer.cornerR... 阅读全文
posted @ 2016-01-11 14:19 i兮兮 阅读(521) 评论(0) 推荐(0)
使用AFNetWorking进行数据请求的那些事儿
摘要:1.通过URL获取JSON格式的数据 (hi,fashion中的应用实例)- (void)viewDidLoad { [super viewDidLoad]; //***网络请求 [self startRequst]; //***设置上拉刷新和下拉加载 __weak FirstViewC... 阅读全文
posted @ 2016-01-07 11:10 i兮兮 阅读(303) 评论(0) 推荐(0)