私は2種類の行を持つ必要があります。私が追加する必要があるため(NSIndexPath *)indexPath:(のUITableView *)のtableView cellForRowAtIndexPath: - (UITableViewCellの*)のtableViewIOS TableView行の高さ
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
if (indexPath.section == 0)
return 90.0;
else
return 44.0;
}
私が呼ばれたときに問題がある:44高さpxと90PXと他の一つの90pxの高さのscrollViewを持つセルですが、上のセルの中央に追加されています。
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を設定しようとすると、問題はscrollViewを追加することです。
私は、コードに次の行を追加する場合:
self.scrollView.frame = CGRectMake(0,-45, 320, 90);
それは完璧に動作しますが、それは私のためにいくつかの奇妙な音が鳴ります。何が起こっている?
ちょうど明確にする - なぜあなたはscrollViewのフレームを調整する必要がありますか? – theTRON
フレームを調整しないと、高さ44 pxありがとう! – xger86x