iOS开发脚踏实地学习day17-彩票


1.iOS8不能显示登录画面,设置lauch image

http://www.woowen.com/swift/2014/12/12/ios8%E8%AE%BE%E7%BD%AELaunch%20Image%20%E5%90%AF%E5%8A%A8%E5%9B%BE%E7%89%87/

2.自定义UITableView
//UITableView形式时grouped
- (id)init
{
    return [super initWithStyle:UITableViewStyleGrouped];
}

- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section{
    return [self.dataList[section] header];//顶部的字母会自动大写的  
}
- (NSString *)tableView:(UITableView *)tableView titleForFooterInSection:(NSInteger)section{
    return  [self.dataList[section] footer];//底部的字母不会自动大写
}

3.设置cell
-(void)setItem:(CellItems *)item{
    _item = item;
    //根据item数据来设置cell
    //1.设置cell子控件数据
    self.imageView.image = [UIImage imageNamed:item.icon];
    self.textLabel.text = item.title;
    //2.设置cell的右侧视图
//    -(BOOL) isKindOfClass: classObj判断是否是这个类或者这个类的子类的实例
//    -(BOOL) isMemberOfClass: classObj 判断是否是这个类的实例
    if ([_item isKindOfClass: [ArrowCellItems class]] ) {
        self.accessoryView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"CellArrow"]];
        self.selectionStyle = UITableViewCellSelectionStyleDefault;//选中的样式,灰色
//        self.userInteractionEnabled = YES;//能点击
    }else if([_item isKindOfClass: [SwitchCellItems class]]){
        self.accessoryView = [[UISwitch alloc]init];
        self.selectionStyle = UITableViewCellSelectionStyleNone;//选中的样式,无
//        self.userInteractionEnabled = NO;//不能点击,选中样式就不用配置,如果这样的话UISwitch也不能点击了。
     
    }
    else{
        self.accessoryView = nil;
        self.selectionStyle = UITableViewCellSelectionStyleDefault;//选中的样式,灰色
//        self.userInteractionEnabled = YES;//能点击

    }
    
}
4.点击cell跳转
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    //取出模型
    CellGroup *group = self.dataList[indexPath.section];
    NSArray *items = group.items;
    CellItems *item = items[indexPath.row];
    if ([item isKindOfClass:[ArrowCellItems class]]) {
        TestViewController *testVC = [[TestViewController alloc]init];
        [self.navigationController pushViewController:testVC animated:YES];
    }
    
}
5.彩票里的设置部分的思路
VIew:继承自TableViewCell
1)item属性,通过setter方法,把数据作为输入,配置cell的item;
2)cellWithTableView,配置cell,tableView作为输入
Model:
1) SettingItem
2) SettingGroup
3) ArrowSettingItem,继承自SettingItem, 通过isKindOfClass来设置cell的右侧视图
4) SwitchSettingItem,继承自SettingItem,通过isKindOfClass来设置cell的右侧视图
Controller:
1)dataList,用懒加载的方法
2) section,row,cell,didselectedAtIndex
2) 配置TableView


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值