//
//  九宫格布局.h
//  IOS笔记

-(void)createUI{
    NSArray *titles = @[@"我的设置",@"我的关注",@"我的账户",@"我的收藏",@"我的下载",@"我的评论",@"我的帮助",@"我的应用"];
    
    NSArray *images = @[@"setting",@"favorite",@"user",@"collect",@"download",@"comment",@"help",@"candou"];
    
    
    for (int i=0; i<titles.count; i++) {
        CGFloat buttonW = (KscreenRect.size.width-30*4)/3.0;
        int H=i/3;
        int L=i%3;
        CGFloat butonX = (buttonW +30)*L+30;
        CGFloat butonY = (buttonW +30)*H+64+30;
        
        
        WQDButton *button = [WQDButton  addButtonWithFrame:CGRectMake(butonX, butonY, buttonW, buttonW) title:nil andBlock:^{
            
            if (3==i) {
                //                CollectionViewController *collection = [[CollectionViewController alloc]init];
                //                [self.navigationController pushViewController:collection animated:YES];
            }
        }];
        [button  setBackgroundImage:[UIImage imageNamed:[NSString  stringWithFormat:@"account_%@",images[i]]] forState:UIControlStateNormal];
        [self.view addSubview:button];
        
        //        UILabel *label = [UILabel  labelWithFrame:CGRectMake(butonX, butonY+buttonW, buttonW, 30) andtitle:titles[i]];
        //
        //        label.font =[UIFont systemFontOfSize:9];
        //        label.textAlignment=NSTextAlignmentCenter;
        //        [self.view addSubview:label];
        
        
    }
    
}