@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