设置类框架用法

//继承 ILBaseSettingViewController 类


创建三种类型的单元格


 一.箭头


    ILSettingArrowItem *push = [ILSettingArrowItem itemWithIcon:@"1" title:@"通用"];


//需要写出来子标题的:
 push.subtitle=@"nihao";


//需要push到ILPushNoticeViewController控制器中。 需要写出来---》
    
  push.showVCClass = [ILPushNoticeViewController class];
    
    
    
 二.开关


  ILSettingSwitchItem *LocationServices = [ILSettingSwitchItem itemWithIcon:@"10" title:@"KVO来实现"];
    
    //保留全局变量
    _LocationServices = LocationServices;
    
    //开关必有key来持久化数据
    _LocationServices.key = ILSettingShakeChoose;
    
    //1.观察LocationServices中的off属性值
    [_LocationServices addObserver:self forKeyPath:@"off" options:NSKeyValueObservingOptionNew context:nil];


//2.观察者响应方法
-(void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary<NSString *,id> *)change context:(void *)context
{
        if(_LocationServices.off == YES){
            NSLog(@"上面关");
        }else{
            NSLog(@"上面开");
        }
    
    if (_SystemServices.off == YES) {
        NSLog(@"下面关");
    }else
    {
        NSLog(@"下面开");
    }


}
//3.移除观察者
-(void)dealloc
{
    [_LocationServices removeObserver:self forKeyPath:@"off"];
    [_SystemServices removeObserver:self forKeyPath:@"off"];
    
}




    
 三.左字右字的


    ILSettingLabelItem *endTime = [ILSettingLabelItem itemWithTitle:@"结束时间"];

    //    endTime.text = @"23:59";

    endTime.key = ILSettingScoreShowEndTime;

    if (endTime.text.length == 0) {

        endTime.text = @"23:59";

    }

    ILSettingGroup *endTimeGroup = [[ILSettingGroup alloc] init];

    endTimeGroup .items = @[endTime];

    [_allGroups addObject:endTimeGroup];


 
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值