上一页 1 2 3 4 5 6 7 ··· 18 下一页

二分查找算法

摘要: 问题: 如果一个数列已排序(从小到大),查找指定元素在其中的位置。 解法: 利用数列已排序的特性,从数列的中间开始搜寻,如果这个数小于所搜寻的数,则该数左边的数 一定都小于要搜寻的对象,所以无需浪费时间在左边的数;如果搜寻的数大于所搜寻的对象,则右边的 数无需再搜寻,直接搜寻左边的数。如此类推,直到 阅读全文
posted @ 2016-06-04 12:44 哈利波特大 阅读(266) 评论(0) 推荐(0)

alloc 函数

摘要: 函数alloc是可返回一个指向n个连续字符存储单元的指针,alloc函数的调用者可以利用该指针存储字符序列。 #define ALLOCSIZE 1000 /* 可用空间大小 */ static char allocbuf[ALLOCSIZE] /* alloc使用的存储区 */ static ch 阅读全文
posted @ 2016-06-04 09:09 哈利波特大 阅读(799) 评论(0) 推荐(0)

iOS解档与归档

摘要: // 解档 - (instancetype)initWithCoder:(NSCoder *)aDecoder { if (self = [super init]) { unsigned int count; Ivar* ivars = class_copyIvarList([self class] 阅读全文
posted @ 2016-06-03 22:58 哈利波特大 阅读(204) 评论(0) 推荐(0)

iOS 模型之中添加非空的方法

摘要: - (id)initWithDict:(NSDictionary *)dict { self = [super init]; if (self) { [self setValuesForKeysWithDictionary:dict]; self.max = [NSString stringWith 阅读全文
posted @ 2016-05-30 18:31 哈利波特大 阅读(309) 评论(0) 推荐(0)

componentsSeparatedByString 和 componentsJoinedByString 比较

摘要: 将string字符串转换为array数组 NSArray *array = [Str componentsSeparatedByString:@","]; 将array数组转换为string字符串 NSString *tempString = [mutableArray componentsJoin 阅读全文
posted @ 2016-05-30 17:19 哈利波特大 阅读(250) 评论(0) 推荐(0)

UIButton的圆角

摘要: _interestedBtn = [UIButton buttonWithType:UIButtonTypeCustom]; _interestedBtn.layer.cornerRadius = 8; _interestedBtn.layer.borderColor = [UIColor oran 阅读全文
posted @ 2016-05-29 11:55 哈利波特大 阅读(239) 评论(0) 推荐(0)

iOS TableView上面有空白的区域时的处理

摘要: if ([self respondsToSelector:@selector(automaticallyAdjustsScrollViewInsets)]) { self.automaticallyAdjustsScrollViewInsets = NO; } 阅读全文
posted @ 2016-05-24 21:40 哈利波特大 阅读(301) 评论(0) 推荐(0)

指针面试题

摘要: while(*s++=*t++); 这个在程序员杂志中,可能先声明了s和t都是字符串指针吧在执行的时候,实现了好几个逻辑,步骤如下:⑴ *t 的赋值给 *s⑵判断 *s 是否为真。如果为假,则跳出循环;否则继续执行第⑶步。因为字符串是以\0结尾的,遇到\0的时候,也就是*s为假,就跳出了字符串拷贝。 阅读全文
posted @ 2016-05-24 20:26 哈利波特大 阅读(203) 评论(0) 推荐(0)

ios 修改导航栏的颜色

摘要: UINavigationBar *bar = [UINavigationBar appearance]; [bar setBarTintColor:[UIColor blueColor]]; // 修改导航栏的颜色为蓝色 [bar setBarStyle:UIBarStyleBlack]; [bar 阅读全文
posted @ 2016-05-23 20:09 哈利波特大 阅读(601) 评论(0) 推荐(0)

UITableView 头部图片 图片拉伸

摘要: UITableView上面添加一个大图片,拖动tableView,图片拉伸,停止拖动,图片变为原来尺寸 - (void)scrollViewDidScroll:(UIScrollView *)scrollView { CGFloat offsetY = scrollView.contentOffse 阅读全文
posted @ 2016-05-22 12:43 哈利波特大 阅读(278) 评论(0) 推荐(0)
上一页 1 2 3 4 5 6 7 ··· 18 下一页