我需要有2种行。一个有高度的44 PX和其他与90像素:IOS TableView行高度
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
if (indexPath.section == 0)
return 90.0;
else
return 44.0;
}
问题是,当我叫 - (UITableViewCell的*)的tableView:(UITableView的*)的tableView的cellForRowAtIndexPath:(NSIndexPath *)indexPath因为我需要添加到90px的单元格,它有90px的高度,但它被添加在单元格的中间,而不是顶部。
if (indexPath.section == 0) {
cell = [tableView dequeueReusableCellWithIdentifier:ScrolledCellIdentifier];
if (cell == nil)
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:ScrolledCellIdentifier];
//cell.textLabel.text = @"hi";
[cell addSubview:self.scrollView];
}
尝试设置单元格的作品为textLabel,问题是增加了滚动。
如果我这一行添加到代码:
self.scrollView.frame = CGRectMake(0,-45, 320, 90);
它完美,但它听起来有些怪异我。发生什么事?
只是为了澄清 - 你为什么需要调整滚动视图的框架? – theTRON 2012-02-07 21:42:28
,因为如果我不调整框架,它需要高度44像素谢谢! – xger86x 2012-02-08 02:48:03