美文网首页
UITableview界面

UITableview界面

作者: 26aa4a305186 | 来源:发表于2018-11-22 21:37 被阅读0次

#import "fiveViewController.h"

#import "SZViewController.h"

@interface fiveViewController ()<UITableViewDelegate,UITableViewDataSource>

{

    UITableView *tbv;

}

@end

@implementationfiveViewController

- (void)viewDidLoad {

    [super viewDidLoad];

    // Do any additional setup after loading the view.

    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"aa"] style:UIBarButtonItemStylePlain target:self action:nil];

    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"bb"] style:UIBarButtonItemStylePlain target:self action:@selector(click)];

    tbv = [[UITableView alloc]initWithFrame:self.view.frame style:UITableViewStylePlain];

    tbv.dataSource = self;

    tbv.delegate=self;

    [self.view addSubview:tbv];

}

- (void)click{

    [self.navigationController pushViewController:[SZViewController new] animated:YES];

}

-(NSInteger)numberOfSectionsInTableView:(UITableView*)tableView{

    return 5;

}

-(NSInteger)tableView:(UITableView*)tableView numberOfRowsInSection:(NSInteger)section{

    if(section==0) {

        return 1;

    }elseif(section==1){

        return 1;

    }elseif(section==2){

        return 1;

    }elseif(section==3){

        return 1;

    }else{

        return 1;

    }

}

-(UITableViewCell*)tableView:(UITableView*)tableView cellForRowAtIndexPath:(NSIndexPath*)indexPath{

    UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"2"];

    if(!cell) {

        cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"2"];

    }

    if(indexPath.section==0) {

        tbv.rowHeight=150;

        cell.backgroundColor= [UIColor redColor];

        UIView *uiv = [[UIView alloc]initWithFrame:CGRectMake(0,0,self.view.frame.size.width,150)];

        UIImageView  *ima = [[UIImageView alloc]initWithFrame:CGRectMake(20,40,100,100)];

        ima.image= [UIImage imageNamed:@"1"];

        ima.layer.masksToBounds= YES;

        ima.layer.cornerRadius = 50;

        [uiv addSubview:ima];

        [cell addSubview:uiv];

        UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(130,90,150,50)];

        label.text=@"谎言";

        [cell addSubview:label];

        UILabel *label2 = [[UILabel alloc]initWithFrame:CGRectMake(280,90,150,50)];

        label2.text=@"成长值2>";

        [cell  addSubview:label2];

    }else  if(indexPath.section==1){

        tbv.rowHeight=150;

        UILabel *label3 = [[UILabel alloc]initWithFrame:CGRectMake(20,0,150,50)];

        label3.text=@"我的订单";

        [cell addSubview:label3];

        UILabel *label4 = [[UILabel alloc]initWithFrame:CGRectMake(250,0,200,50)];

        label4.text=@"查看全部订单>";

        [cell addSubview:label4];

        UIImageView  *ima5 = [[UIImageView alloc]initWithFrame:CGRectMake(28,60,50,50)];

        ima5.image= [UIImage imageNamed:@"11"];

        ima5.layer.masksToBounds = YES;

        ima5.layer.cornerRadius=25;

        [cell addSubview: ima5];

        UILabel  *lab5 = [[UILabel alloc]initWithFrame:CGRectMake(30,110,60,20)];

        lab5.text=@"当前订单";

        lab5.font= [UIFont systemFontOfSize:10];

        [cell addSubview:lab5];

        UIImageView  *ima6 = [[UIImageView alloc]initWithFrame:CGRectMake(128,60,50,50)];

        ima6.image= [UIImage imageNamed:@"11"];

        ima6.layer.masksToBounds = YES;

        ima6.layer.cornerRadius=25;

        [cell addSubview: ima6];

        UILabel  *lab6 = [[UILabel alloc]initWithFrame:CGRectMake(130,110,60,20)];

        lab6.text=@"当前订单";

        lab6.font= [UIFont systemFontOfSize:10];

        [cell addSubview:lab6];

        UIImageView  *ima7 = [[UIImageView alloc]initWithFrame:CGRectMake(228,60,50,50)];

        ima7.image= [UIImage imageNamed:@"11"];

        ima7.layer.masksToBounds = YES;

        ima7.layer.cornerRadius=25;

        [cell addSubview: ima7];

        UILabel * lab7 = [[UILabel alloc]initWithFrame:CGRectMake(230,110,60,20)];

        lab7.text=@"当前订单";

        lab7.font= [UIFont systemFontOfSize:10];

        [cell addSubview:lab7];

        UIImageView * ima8 = [[UIImageView alloc]initWithFrame:CGRectMake(328,60,50,50)];

        ima8.image= [UIImage imageNamed:@"11"];

        ima8.layer.masksToBounds = YES;

        ima8.layer.cornerRadius=25;

        [cell addSubview: ima8];

        UILabel  *lab8 = [[UILabel alloc]initWithFrame:CGRectMake(330,110,60,20)];

        lab8.text=@"当前订单";

        lab8.font= [UIFont systemFontOfSize:10];

        [cell addSubview:lab8];

    }else if(indexPath.section==2){

        tbv.rowHeight=130;

        UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(10,0,150,50)];

        label.text=@"我的钱包";

        [cell addSubview:label];

        UILabel  *label2 = [[UILabel alloc]initWithFrame:CGRectMake(47,50,100,50)];

        label2.text=@"0元";

        [cell addSubview:label2];

        UILabel *label3 = [[UILabel alloc]initWithFrame:CGRectMake(20,80,100,50)];

        label3.text=@"可用余额";

        [cell addSubview:label3];

        UILabel *label4 = [[UILabel alloc]initWithFrame:CGRectMake(145,50,100,50)];

        label4.text=@"0";

        [cell addSubview:label4];

        UILabel *label5 = [[UILabel alloc]initWithFrame:CGRectMake(134,80,100,50)];

        label5.text=@"贝币";

        [cell addSubview:label5];

        UILabel *label6 = [[UILabel alloc]initWithFrame:CGRectMake(220,50,100,50)];

        label6.text=@"0张";

        [cell addSubview:label6];

        UILabel *label7 = [[UILabel alloc]initWithFrame:CGRectMake(210,80,100,50)];

        label7.text=@"优惠券";

        [cell addSubview:label7];

        UILabel *label8 = [[UILabel alloc]initWithFrame:CGRectMake(300,50,100,50)];

        label8.text=@"0万元";

        [cell addSubview:label8];

        UILabel *label9 = [[UILabel alloc]initWithFrame:CGRectMake(290,80,100,50)];

        label9.text=@"可借现金";

        [cell addSubview:label9];

    }else if(indexPath.section==3){

        tbv.rowHeight = 200;

        UIImageView  *ima = [[UIImageView alloc]initWithFrame:CGRectMake(20,10,50,50)];

        ima.image= [UIImage imageNamed:@"11"];

        ima.layer.masksToBounds = YES;

        ima.layer.cornerRadius = 25;

        [cell addSubview: ima];

        UILabel  *lab = [[UILabel alloc]initWithFrame:CGRectMake(24,65,60,20)];

        lab.text=@"当前订单";

        lab.font= [UIFont systemFontOfSize:10];

        [cell addSubview:lab];

        UIImageView  *ima2 = [[UIImageView alloc]initWithFrame:CGRectMake(120,10,50,50)];

        ima2.image= [UIImage imageNamed:@"22"];

        ima2.layer.masksToBounds = YES;

        ima2.layer.cornerRadius=25;

        [cell addSubview: ima2];

        UILabel *lab2 = [[UILabel alloc]initWithFrame:CGRectMake(124,65,60,20)];

        lab2.text=@"代付款";

        lab2.font= [UIFont systemFontOfSize:10];

        [cell addSubview:lab2];

        UIImageView *ima3 = [[UIImageView alloc]initWithFrame:CGRectMake(220,10,50,50)];

        ima3.image= [UIImage imageNamed:@"33"];

        ima3.layer.masksToBounds = YES;

        ima3.layer.cornerRadius=25;

        [cell addSubview: ima3];

        UILabel *lab3 = [[UILabel alloc]initWithFrame:CGRectMake(224,65,60,20)];

        lab3.text=@"当前订单";

        lab3.font= [UIFont systemFontOfSize:10];

        [cell addSubview:lab3];

        UIImageView  *ima4 = [[UIImageView alloc]initWithFrame:CGRectMake(320,10,50,50)];

        ima4.image= [UIImage imageNamed:@"44"];

        ima4.layer.masksToBounds = YES;

        ima4.layer.cornerRadius=25;

        [cell addSubview: ima4];

        UILabel *lab4 = [[UILabel alloc]initWithFrame:CGRectMake(324,65,60,20)];

        lab4.text=@"当前订单";

        lab4.font= [UIFont systemFontOfSize:10];

        [cell addSubview:lab4];

        UIImageView *ima5 = [[UIImageView alloc]initWithFrame:CGRectMake(20,100,50,50)];

        ima5.image= [UIImage imageNamed:@"11"];

        ima5.layer.masksToBounds = YES;

        ima5.layer.cornerRadius=25;

        [cell addSubview: ima5];

        UILabel *lab5 = [[UILabel alloc]initWithFrame:CGRectMake(24,155,60,20)];

        lab5.text=@"当前订单";

        lab5.font= [UIFont systemFontOfSize:10];

        [cell addSubview:lab5];

        UIImageView *ima6 = [[UIImageView alloc]initWithFrame:CGRectMake(120,100,50,50)];

        ima6.image= [UIImage imageNamed:@"22"];

        ima6.layer.masksToBounds = YES;

        ima6.layer.cornerRadius=25;

        [cell addSubview: ima6];

        UILabel  *lab6 = [[UILabel alloc]initWithFrame:CGRectMake(124,155,60,20)];

        lab6.text=@"代付款";

        lab6.font= [UIFont systemFontOfSize:10];

        [cell addSubview:lab6];

        UIImageView  *ima7 = [[UIImageView alloc]initWithFrame:CGRectMake(220,100,50,50)];

        ima7.image= [UIImage imageNamed:@"33"];

        ima7.layer.masksToBounds = YES;

        ima7.layer.cornerRadius=25;

        [cell addSubview: ima7];

        UILabel *lab7 = [[UILabel alloc]initWithFrame:CGRectMake(224,155,60,20)];

        lab7.text=@"当前订单";

        lab7.font= [UIFont systemFontOfSize:10];

        [cell addSubview:lab7];

        UIImageView *ima8 = [[UIImageView alloc]initWithFrame:CGRectMake(320,100,50,50)];

        ima8.image= [UIImage imageNamed:@"44"];

        ima8.layer.masksToBounds = YES;

        ima8.layer.cornerRadius=25;

        [cell addSubview: ima8];

        UILabel  *lab8 = [[UILabel alloc]initWithFrame:CGRectMake(324,155,60,20)];

        lab8.text=@"当前订单";

        lab8.font= [UIFont systemFontOfSize:10];

        [cell addSubview:lab8];

    }

    return cell;

}

@end

相关文章

网友评论

      本文标题:UITableview界面

      本文链接:https://www.haomeiwen.com/subject/hyvrqqtx.html