简单导航

@interface ViewController ()<UITableViewDelegate,UITableViewDataSource>
{
UITableView *tbv;
}
@end

@implementation ViewController

  • (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    self.title = @“课程详情”;
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"<" style:UIBarButtonItemStyleDone target:self action:nil];

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

}
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 1;
}

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return 2;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *re = @“123”;
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:re];
if(!cell)
{
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:re];
}
if(indexPath.row == 0)
{
tbv.rowHeight = 120;
UILabel *qwe = [[UILabel alloc] initWithFrame:CGRectMake((self.view.frame.size.width - 150) / 2, 20, 150, 90)];
qwe.text = @“怪兽”;
qwe.font = [UIFont systemFontOfSize:35];
[cell addSubview:qwe];
}else
{
tbv.rowHeight = 600;
UILabel *one = [[UILabel alloc] initWithFrame:CGRectMake(30, 30, 300, 50)];
one.font = [UIFont systemFontOfSize:15];
one.text = @“怪兽 怪兽怪兽怪兽怪兽怪兽怪兽”;
[cell addSubview:one];
UILabel *two = [[UILabel alloc] initWithFrame:CGRectMake(30, 70, 300, 50)];
two.font = [UIFont systemFontOfSize:15];
two.text = @“怪兽 怪兽怪兽怪兽怪兽怪兽怪兽怪兽”;
[cell addSubview:two];
UILabel *three = [[UILabel alloc] initWithFrame:CGRectMake(30, 110, 300, 50)];
three.font = [UIFont systemFontOfSize:15];
three.text = @“怪兽 怪兽怪兽怪兽怪兽怪兽”;
[cell addSubview:three];
UILabel *four = [[UILabel alloc] initWithFrame:CGRectMake(30, 150, 300, 50)];
four.font = [UIFont systemFontOfSize:15];
four.text = @“怪兽 怪兽怪兽怪兽怪兽怪兽怪兽”;
[cell addSubview:four];
UILabel *five = [[UILabel alloc] initWithFrame:CGRectMake(30, 220, 300, 50)];
five.font = [UIFont systemFontOfSize:15];
five.text = @“怪兽 怪兽怪兽怪兽”;
[cell addSubview:five];
UILabel *sex = [[UILabel alloc] initWithFrame:CGRectMake(30, 290, 300, 50)];
sex.font = [UIFont systemFontOfSize:15];
sex.numberOfLines = 0;
sex.lineBreakMode = UILineBreakModeCharacterWrap;
sex.text = @“怪兽 怪兽怪兽怪兽怪兽怪兽 怪兽怪兽怪兽怪兽怪兽怪兽怪兽怪兽怪兽怪兽怪兽怪兽怪兽怪兽怪兽怪兽怪兽怪兽怪兽怪兽怪兽怪兽怪兽怪兽怪兽怪兽怪兽怪兽怪兽v”;
[cell addSubview:sex];
}

return cell;
}

  • (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
    {

    [tbv deselectRowAtIndexPath:indexPath animated:YES];
    }
    -(void)tz{

}
@end

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值