04 2016 档案

设置UITableViewCell右侧的箭头
摘要:cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; 阅读全文

posted @ 2016-04-30 23:40 哈利波特大 阅读(774) 评论(0) 推荐(0)

关于离线缓存webView的新方法NSURLProtocol
摘要:博文转发自:http://blog.sina.com.cn/s/blog_6291e42d0102v0hf.html 对于目前UIWebView的离线缓存方式主要有如下几种: 1.HTML5 , Manifest最开始我的想法是使用HTML5中的离线存储功能,也就是分析Manifest文件来存储和更 阅读全文

posted @ 2016-04-30 09:45 哈利波特大 阅读(1049) 评论(0) 推荐(0)

oc面试 内存泄露
摘要:====================================================== 老实说,当看到这块代码的时候,怎么也没发现问题。 假如说someLargeNumber趋于无穷大,得产生无穷个NSString类型的string。 先说一下堆栈之间的区别: 由此可见,频繁的 阅读全文

posted @ 2016-04-28 21:03 哈利波特大 阅读(297) 评论(0) 推荐(0)

cocoaPod 使用
摘要:一、概要 iOS开发时,项目中会引用许多第三方库,CocoaPods(https://github.com/CocoaPods/CocoaPods)可以用来方便的统一管理这些第三方库。 二、安装 由于网上的教程基本都大同小异,但细节之处还不是很完善,所以借机会在这里补充下: 注:要使用CocoaPo 阅读全文

posted @ 2016-04-21 15:46 哈利波特大 阅读(231) 评论(0) 推荐(0)

iOS 7 开启侧滑效果
摘要:if ([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) { self.navigationController.interactivePopGestureRecogn 阅读全文

posted @ 2016-04-15 20:05 哈利波特大 阅读(183) 评论(0) 推荐(0)

数组排序
摘要:NSArray *array = @[@"John Appleseed", @"Tim Cook", @"Hair Force One", @"Michael Jurewitz"]; NSArray *sortedArray = [array sortedArrayUsingSelector:@se 阅读全文

posted @ 2016-04-15 18:46 哈利波特大 阅读(210) 评论(0) 推荐(0)

JSON 保存到本地
摘要:NSArray *array = [NSJSONSerialization JSONObjectWithData:[NSData data] options:NSJSONReadingAllowFragments error:nil]; NSArray *docs = NSSearchPathFor 阅读全文

posted @ 2016-04-14 20:40 哈利波特大 阅读(506) 评论(0) 推荐(0)

C语言指针
摘要:用变量a给出下面的定义a)一个整型数b)一个指向整型数的指针(Apointertoaninteger)c)一个指向指针的的指针,它指向的指针是指向一个整型数(Apointertoapointertoanintege)rd)一个有10个整型数的数组(Anarrayof10integers)e)一个有1 阅读全文

posted @ 2016-04-14 17:09 哈利波特大 阅读(216) 评论(0) 推荐(0)

iOS block
摘要:对于大多数人来讲,block内部到底是怎样实现的呢?我们可以借助clang将其编译成为c++的代码,就可以看出,block到底是什么东西, 先来看这样一个问题, 以及下面的这一段代码 你会发现这两个结果是不同的, 第一个输出10,第二个输出的是30 要想知道这里面干了些什么!需要我们将其编译成为C+ 阅读全文

posted @ 2016-04-14 16:19 哈利波特大 阅读(191) 评论(0) 推荐(0)

iOS 通知 代理 block
摘要:通知:“一对多”,在APP中,很多控制器都需要知道一个事件,应该用通知;delegate:1,“一对一”,对同一个协议,一个对象只能设置一个代理delegate,所以单例对象就不能用代理;2,代理更注重过程信息的传输:比如发起一个网络请求,可能想要知道此时请求是否已经开始、是否收到了数据、数据是否已 阅读全文

posted @ 2016-04-14 16:10 哈利波特大 阅读(230) 评论(0) 推荐(0)

循环引用的案例
摘要:一、parent-child相互持有、委托模式 【案例】: ? 1 2 3 4 5 6 @interface FTAppCenterMainViewController () { } @property(weak,nonatomic) UITableView* myTableView; @end ? 阅读全文

posted @ 2016-04-14 15:43 哈利波特大 阅读(152) 评论(0) 推荐(0)

UISearchController
摘要:#import "ViewController.h" @interface ViewController () <UITableViewDelegate, UITableViewDataSource, UISearchResultsUpdating, UISearchControllerDelega 阅读全文

posted @ 2016-04-14 09:35 哈利波特大 阅读(385) 评论(0) 推荐(0)

循环创建按钮
摘要:CGFloat margin = 22; CGFloat btnW = 35; CGFloat btnH = 35; int cloums = 7; CGFloat btnLeft = (self.view.frame.size.width - (btnW * cloums) - (cloums - 阅读全文

posted @ 2016-04-13 17:56 哈利波特大 阅读(258) 评论(0) 推荐(0)

UITextField Delegate
摘要:- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField; // return NO to disallow editing. 返回NO 文本框不可编辑 - (void)textFieldDidBeginEditing:(UITextF 阅读全文

posted @ 2016-04-11 19:26 哈利波特大 阅读(220) 评论(0) 推荐(0)

键盘的弹出和收回
摘要:[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyBoardFrameChange:) name:UIKeyboardWillChangeFrameNotification object:nil] 阅读全文

posted @ 2016-04-11 19:22 哈利波特大 阅读(206) 评论(0) 推荐(0)

循环创建按钮
摘要:#import "UserCell.h" #define kBorderX 5 // 左边 #define kBorderY 0 // 上边 #define kMargin 5 #define kImageViewW ([UIScreen mainScreen].bounds.size.width 阅读全文

posted @ 2016-04-04 16:04 哈利波特大 阅读(141) 评论(0) 推荐(0)

通过Xib创建 UICollectionView 和自定义UICollectionViewCell
摘要:1。在控制器的viewDidLoad方法中添加代码 CGFloat itemWidth = (kScreenW - kSpacingW * 3) / 2; NSLog(@"itemWidth == %f",itemWidth); CGFloat itemHeight = itemWidth * 0. 阅读全文

posted @ 2016-04-03 17:50 哈利波特大 阅读(1613) 评论(0) 推荐(0)

iOS 9.0 设置状态栏颜色 和隐藏
摘要:- (UIStatusBarStyle)preferredStatusBarStyle { //设置样式 return UIStatusBarStyleLightContent; } - (BOOL)prefersStatusBarHidden { //设置隐藏 return YES; } 阅读全文

posted @ 2016-04-01 21:40 哈利波特大 阅读(318) 评论(0) 推荐(0)