随笔分类 -  iOS

摘要:在iOS开发过程中,不管是做什么应用,都会碰到数据保存的问题。将数据保存到本地,能够让程序的运行更加流畅,不会出现让人厌恶的菊花形状,使得用户体验更好。下面介绍一下数据保存的方式: 1.NSKeyedArchiver:采用归档的形式来保存数据,该数据对象需要遵守NSCoding协议,并且该对象对应的 阅读全文
posted @ 2016-04-26 20:31 偏执Dog 阅读(2673) 评论(0) 推荐(0)
摘要:首先,UIControlEvents有这个几种: UIControlEventTouchDown = 1 << 0, // on all touch downs UIControlEventTouchDownRepeat = 1 << 1, // on multiple touchdowns (ta 阅读全文
posted @ 2016-04-21 11:38 偏执Dog 阅读(237) 评论(0) 推荐(0)
摘要:如果导航控制器的BarButtonItem属性是一致的,可以重写initialize方法用来设置主题 也可以一次性设置leftBarButtonItem和rightBarButtonItem 重写 - (void)pushViewController:(UIViewController *)view 阅读全文
posted @ 2016-04-03 20:23 偏执Dog 阅读(124) 评论(0) 推荐(0)
摘要:self.window = [[UIWindow alloc] init]; self.window.frame = [UIScreen mainScreen].bounds; oneViewController *oneview = [[oneViewController alloc] init]; //设置tabbarItem的图片并且设置渲染模式为UIImag... 阅读全文
posted @ 2016-04-03 19:42 偏执Dog 阅读(88) 评论(0) 推荐(0)
摘要:scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, 320, 460)]; scrollView.backgroundColor = [UIColor redColor]; // 是否支持滑动最顶端 // scrollV 阅读全文
posted @ 2016-04-01 20:48 偏执Dog 阅读(123) 评论(0) 推荐(0)
摘要://根据文字获取size - (CGSize)getSizeWithstring:(NSString *)string { CGSize maxSize = CGSizeMake(320, 320); NSDictionary *dict = @{NSFontAttributeName : [UIF 阅读全文
posted @ 2016-04-01 14:57 偏执Dog 阅读(166) 评论(0) 推荐(0)
摘要:在Info.plist文件中添加如下配置: //始终允许访问位置信息 (1)NSLocationAlwaysUsageDescription //使用应用程序期间允许访问位置数据 (2)NSLocationWhenInUseUsageDescription //创建一个管理者 - (CLLocati 阅读全文
posted @ 2016-03-18 12:06 偏执Dog 阅读(293) 评论(0) 推荐(0)
摘要:假如你是类似于这样跳转过来的self presentViewController: animated: completion:那么你回去的时候就要dismiss假如你是这样跳转过来的 self.navigationController pushViewController: animated: 那么 阅读全文
posted @ 2016-03-15 18:45 偏执Dog 阅读(237) 评论(0) 推荐(0)
摘要:文件下载链接:http://pan.baidu.com/s/1eRp8B6q 阅读全文
posted @ 2016-03-13 14:24 偏执Dog 阅读(380) 评论(0) 推荐(0)
摘要:使用Quartz2D前 先导入QuartzCore.framework //划线 常用拼接路径函数 新建一个起点void CGContextMoveToPoint(CGContextRef c, CGFloat x, CGFloat y) 添加新的线段到某个点void CGContextAddLin 阅读全文
posted @ 2015-12-15 21:01 偏执Dog 阅读(146) 评论(0) 推荐(0)
摘要:$(SRCROOT)/项目名/pch文件名.pch //0-255的随机数 #define randint arc4random() % 256 //随机色 #define randColor [UIColor colorWithRed:randint/255.0 green:randint/255 阅读全文
posted @ 2015-12-15 20:59 偏执Dog 阅读(166) 评论(0) 推荐(0)
摘要:/** * 修改状态栏颜色 * UIStatusBarStyleDefault 默认黑色,在浅色的背景上使用 * UIStatusBarStyleLightContent 亮白,在深色的背景上使用 * UIStatusBarStyleDefault IOS7之后淘汰 * UIStatusBarSty 阅读全文
posted @ 2015-12-15 11:28 偏执Dog 阅读(162) 评论(0) 推荐(0)
摘要:UILabel *label = [[UILabel alloc] init]; label.backgroundColor = [UIColor blackColor]; [self.view addSubview:label]; label.text = @"这是文字"; label.textC 阅读全文
posted @ 2015-12-11 20:31 偏执Dog 阅读(366) 评论(0) 推荐(0)
摘要:1.模型类中定义好属性 2.用AFN请求下来的数据保存到字典中 3.从字典中取出微博字典数组 //微博字典数组 NSArray *restrictArray = responseObject[@"statuses"]; 4.用MJExtension把微博字典数组转成微博模型数组 //微博模型数组 N 阅读全文
posted @ 2015-12-03 16:26 偏执Dog 阅读(450) 评论(0) 推荐(0)
摘要:UIRefreshControl *refresh = [[UIRefreshControl alloc] init]; //这里控制器集成UITableViewController所以是self.tableView [self.tableView addSubview:refresh]; /** 阅读全文
posted @ 2015-12-03 16:00 偏执Dog 阅读(300) 评论(0) 推荐(0)
摘要:CGFloat headimageX = self.view.frame.size.width * 0.2; CGFloat headimageY = self.view.frame.size.height * 0.25; CGFloat headimageW = self.view.frame.s 阅读全文
posted @ 2015-11-23 15:52 偏执Dog 阅读(467) 评论(0) 推荐(0)
摘要://tabbarItem正常状态的属性 NSMutableDictionary *nor = [NSMutableDictionary dictionary]; nor[NSForegroundColorAttributeName] = [UIColor redColor]; //tabbarIte 阅读全文
posted @ 2015-11-08 15:41 偏执Dog 阅读(3325) 评论(1) 推荐(0)
摘要:1、同步请求可以从因特网请求数据,一旦发送同步请求,程序将停止用户交互,直至服务器返回数据完成,才可以进行下一步操作, 2、异步请求不会阻塞主线程,而会建立一个新的线程来操作,用户发出异步请求后,依然可以对UI进行操作,程序可以继续运行 3、GET请求,将参数直接写在访问路径上。操作简单,不过容易被 阅读全文
posted @ 2015-11-02 09:07 偏执Dog 阅读(580) 评论(0) 推荐(0)