• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
飞鸿518
博客园    首页    新随笔    联系   管理    订阅  订阅

OC 九宫格

- (void)createBotList{

 

    CGFloat width = self.frame.size.height * 0.095;

    CGFloat place = (self.frame.size.width - self.frame.size.height * 0.1 * 3) / 4;

    _botView = [[UIView alloc]initWithFrame:CGRectMake(0,self.frame.size.height - self.frame.size.height * 0.25, self.frame.size.width, self.frame.size.height * 0.3)];

    _botView.backgroundColor = [UIColor whiteColor];

 

    NSArray * nameLabArr = @[@"我要充值",@"我要提现",@"我的推广",@"资金明细",@"我的投资",@"我的借款"];

    NSArray * nameImgArr = @[@"wycz",@"wytx",@"wdtg",@"zjmx",@"wdtz",@"wdjd"];

 

    for (NSUInteger i = 0; i < 6; i++) {

        UIImageView * imageView = [[UIImageView alloc]initWithFrame:CGRectMake(place * (i % 3 + 1) + width * (i % 3), 5 + place * ( i / 3) + (width - 10) * (i / 3), width, width)];

        imageView.image = [UIImage imageNamed:nameImgArr[i]];

        [_botView addSubview:imageView];

    }

 

    for (NSUInteger i = 0; i < 6; i++) {

        UILabel * label = [[UILabel alloc]initWithFrame:CGRectMake(place * (i % 3 + 1) + width * (i % 3), 5 + place * ( i / 3) + (width - 10) * (i / 3) + width, width, 13)];

        label.text = nameLabArr[i];

        label.textColor = [UIColor grayColor];

        label.textAlignment = NSTextAlignmentCenter;

        label.font = [UIFont systemFontOfSize:11];

        [_botView addSubview:label];

    }

 

    [self addSubview:_botView];

 

}

posted @ 2018-04-02 12:32  飞鸿518  阅读(193)  评论(0)    收藏  举报
刷新页面返回顶部
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3