07 2018 档案
59.加载Viewcontroller的几种方法(添加导航,解决xib里面空间不显示问题)
摘要:- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { UIStoryboard *storyboard = [UIStoryboar
阅读全文
58.UIScrollView XIB拖拽约束
摘要:第一步: 拖拽UIScrollView 到控制器上 ,给scrollView 添加约束 ,这时是正常的 第二步:scrollview上添加UIview ,(注意:这个 ScrollView就是根据这个UIview 来确定ContentSize的大小的).这时,会报红色警告,不用管,也不要处理(下面这
阅读全文
57.移除指定视图
摘要://依次遍历self.view中的所有子视图 // for(id tmpView in [view subviews]) // { // //找到要删除的子视图的对象 // if([tmpView isKindOfClass:[UIView class]]) // { // UIView *line
阅读全文
56.九宫格布局
摘要:- (void)viewDidLoad { [super viewDidLoad]; //每个Item宽高 CGFloat W = 80; CGFloat H = 100; //每行列数 NSInteger rank = 3; //每列间距 CGFloat rankMargin = (self.vi
阅读全文
55.UIbutton点击切换颜色
摘要:#import "ViewController.h" #define width_w [UIScreen mainScreen].bounds.size.width #define height_h [UIScreen mainScreen].bounds.size.height #define P
阅读全文
54.NSJSONSerialization类进行json解析(字符串“UTF-8解码”)
摘要:NSDictionary *dic = [NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingAllowFragments error:nil] ; 方法:解析并转码 - (NSString*)data
阅读全文
53.设置内容的行间距
摘要://设置介绍内容行间距 -(void)LineSpacing:(UILabel*)lab{ NSMutableAttributedString * attributedString1 = [[NSMutableAttributedString alloc] initWithString:lab.te
阅读全文
52.tableViewCell重用机制避免重复显示问题
摘要:表刷新超出页面显示的内容会重复出现 -(UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ //定义唯一标识 static NSString *cell
阅读全文