代码改变世界

随笔档案-2015年10月

IOS -UIButton设置边框颜色

2015-10-21 10:42 by 一树一菩提, 2294 阅读, 收藏,
摘要: 1.UIButton边框为浅灰色: CGColorSpaceRef colorSpaceRef = CGColorSpaceCreateDeviceRGB(); CGColorRef color = CGColorCreate(colorSpaceRef, (CGFloat[]){0.1,0... 阅读全文

IOS UIButton(UIEdgeInsets)/设置图片和文字上下垂直居中对齐

2015-10-14 09:25 by 一树一菩提, 6962 阅读, 收藏,
摘要: UIEdgeInsetstypedef struct UIEdgeInsets { CGFloat top, left, bottom, right; // specify amount to inset (positive) for each of the edges. values ca... 阅读全文

IOS 添加刷新按钮,刷新当前页面(contentOffset)

2015-10-12 16:48 by 一树一菩提, 1239 阅读, 收藏,
摘要: 刷新按钮添加在导航栏的右上放,本来已经有了下拉刷新的功能,现在就是不想每次刷新都要跑到最上面,所以添加了这么个按钮。 代码: //添加刷新按钮-2015.10.10 UIBarButtonItem *refreshBtn = [[UIBarButtonItem alloc]initWithTitle 阅读全文

IOS UIBarButtonItem 位置偏移的问题

2015-10-11 13:03 by 一树一菩提, 3849 阅读, 收藏,
摘要: 如题,解决这个问题有多重方法。可以重写UINavigationItem 的setRightBarButtonItem和setLeftBarButtonItem函数,调整button的位置,也可以创建一个UIBarButtonSystemItemFixedSpace 类型的UIBarButtonIte... 阅读全文

iOS 错误: [NSNull length]: unrecognized selector sent to instance 0x110504af0'

2015-10-04 12:09 by 一树一菩提, 361 阅读, 收藏,
摘要: 错误: [NSNull length]: unrecognized selector sent to instance 0x110504af0'查看数据发现,读取registerDate时,registerDate 是null,如果直接读取就报上面的错误:{"userId":"1","nickNam... 阅读全文

IOS 自定义的UITableViewCell实现UITableView

2015-10-04 11:31 by 一树一菩提, 166 阅读, 收藏,
摘要: 出错:this class is not key value coding-compliant for the key1.检查各种连线,多连线,少连线都会导致错误 2.检查自定义cell的class:3.检查cell的file's owner的class:4.自定义cell的Identificat... 阅读全文