보기 컨트롤러에 두 개의 uitableviews가 있습니다. 첫 번째 테이블은 프로그래밍 방식으로 uiscrollview에 설정되고 다른 테이블은 스토리 보드에서 self.view에 설정됩니다. 두 테이블 모두 rowHeight를 45로 설정했습니다. 그러나 점차적으로 한 테이블의 높이는 내가 보여준 스크린 샷처럼 행 수가 증가함에 따라 계속 증가합니다.점차적으로 uitableview의 행 높이가 달라집니다.
scrollview = [[UIScrollView alloc] initWithFrame:CGRectMake(130, 45, self.view.frame.size.width-130, self.view.frame.size.height-45)];
scrollview.backgroundColor = [UIColor colorWithRed:0.42 green:0.27 blue:0.60 alpha:1.0];
tableGradeValue = [[UITableView alloc] initWithFrame:CGRectMake(0, 35, self.view.frame.size.width, self.view.frame.size.height-75) style:UITableViewStylePlain];
tableGradeValue.delegate = self;
tableGradeValue.dataSource = self;
self.tableCourse.delegate = self;
self.tableCourse.dataSource = self;
tableGradeValue.rowHeight = 45;
scrollview.bounces = NO;
for(int i = 0; i< [res6Keys count]; i++)
{
CGFloat y = i * 150;
UILabel *lblCell = [[UILabel alloc] initWithFrame:CGRectMake(y, 1, 140, 31)];
lblCell.tag = i+1;
[scrollview addSubview:lblCell];
lblCell.backgroundColor = [UIColor clearColor];
lblCell.textColor = [UIColor colorWithRed:0.93 green:0.92 blue:0.96 alpha:1.0];
lblCell.text = [res6Keys objectAtIndex:i];
}
[scrollview addSubview:tableGradeValue];
scrollview.contentSize = CGSizeMake(self.view.frame.size.width, self.view.frame.size.height);
[self.view addSubview:scrollview];
을 그리고 다른있는 tableview은 일반적으로 스토리 보드에서 설정되고 rowHeight에는 45
UITableview는 scrollview에서 상속되므로 스크롤보기에 넣은 이유는 무엇입니까? 정말 그걸 얻지 못했습니까?! – nikhil84
scrollview의 tableview는 가로 및 세로로 스크롤 할 수 있기 때문에 테이블 뷰의 일부가 아니지만 스크롤 뷰에 계속 유지되지만 여전히 테이블과 함께 스크롤되어 MSExcel을 제공하는 맨 위의 제목 행이 있습니다 보기. –
@LeoJoseph 잘못 가고있는 곳을 더 잘 이해할 수 있도록 코드를 올리시겠습니까? – z22