静态cell 适合“我的”界面 定义cell
查看次数:4154
下载次数:405
上传时间:2016-06-30
大小:120 B
这是一个自己封装的静态的cell 适合我的界面 右侧可以有开关switch label 和跳转界面
使用方法:(导入#import "CLStaticCell/CLStaticCell.h"头文件)
// 创建组
CLCommonGroup *group = [CLCommonGroup group];
[self.groups addObject:group];
//创建右侧是Label的cell
CLCommonLabel *label = [CLCommonLabel itemWithTitle:@"jsdlf"];
label.text = @"wailhfalsudjf";
label.icon = @"rightArrow";
//cell可以被点击
CLCommonLabel *label1 = [CLCommonLabel itemWithIcon:@"rightArrow" title:@"jadl;gkja" cellPressed:^{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示" message:@"label cell 被点击" delegate:self cancelButtonTitle:@"ok" otherButtonTitles:nil];
[alert show];
NSLog(@"label cell 被点击");
}];
label1.text = @"wailhfalsudjf";
//加入组
group.items = @[label,label1];
CLCommonGroup *group1 = [CLCommonGroup group];
[self.groups addObject:group1];
CLCommonSwitchItem *label2 = [CLCommonSwitchItem itemWithIcon:@"rightArrow" title:@"fad" valueChange:^(BOOL isOn) {
NSString *str = nil;
isOn?(str=@"打开"):(str=@"关闭");
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示" message:str delegate:self cancelButtonTitle:@"ok" otherButtonTitles:nil];
[alert show];
NSLog(@"%@",str);
}];
group1.items = @[label2];
CLCommonGroup *group2 = [CLCommonGroup group];
[self.groups addObject:group2];
CLCommonArrowItem *label4 = [CLCommonArrowItem itemWithTitle:@"jsdlf"];
label.text = @"wailhfalsudjf";
label.icon = @"rightArrow";
label4.detailClass = [ViewController class];
CLCommonArrowItem *label5 = [CLCommonArrowItem itemWithIcon:@"rightArrow" title:@"jadl;gkja"];
label.text = @"wailhfalsudjf";
label5.detailClass = [ViewController class];
group2.items = @[label4,label5];
收藏