创建三行三列按钮

  [viewcell.contentViewaddSubview:_xunBtn];

    [viewcell.contentViewaddSubview:redview];

    CGFloatstartx =30;

    CGFloatstarty =0;

    CGFloatwidth_space = (WIDTH-60-240)/2;

    CGFloatheight_space =40;

    CGFloatbtnwidth =80;

    CGFloatbtnheiht =20;

    NSArray *weiziarray = [NSArray arrayWithObjects:@"意见反馈 ",@"分享记录",@"关于我们",@"清除缓存",@"我的珍藏",@"我的私密", @"联系我们",@"退出登录",nil];

    NSArray *picarray = [NSArray arrayWithObjects:@"yjfk_",@"bbgx_",@"gywm_",@"qchc_",@"lsjl_",@"xgmm_", @"lxwm_",@"tcdl_",nil];

    for(inti =0; i<8; i++) {

        NSIntegerindex = i%3;

        NSIntegerpage = i/3;

         _xunBtn= [[xunhuanBtnalloc]init];

        _xunBtn.frame=CGRectMake(index*(btnwidth+width_space)+startx, page*(btnheiht+height_space), btnwidth, btnheiht);

        _xunBtn.tag= i;

        [_xunBtn addTarget:self action:@selector(clickxunH:) forControlEvents:UIControlEventTouchUpInside];

        _xunBtn.rightLabel.text= weiziarray[i];

        _xunBtn.rightLabel.textColor= [UIColorcolorWithRed:0.0/255green:123.0/255blue:238.0/255alpha:1];

        _xunBtn.leftView.image= [UIImageimageNamed:picarray[i]];

        [redviewaddSubview:_xunBtn];

    }

你可能感兴趣的:(创建三行三列按钮)