你的問題不清楚。你想啓用垂直滾動到UITextView &禁用水平滾動?
對於其他問題:
嘗試的UITableView,使用不同的自定義單元格。
或者
簡單,使用的UIView,增加scrollView.contentSize。
下面是如何在一個UITableView中使用不同的定製單元:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
if(indexPath.section==0)
{
static NSString *simpleTableIdentifier = @"SimpleTableCell";
FirstCustomCell *cell = (FirstCustomCell *)[tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier];
if (cell == nil)
{
NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"FirstCustomCell" owner:self options:nil];
cell = [nib objectAtIndex:0];
}
cell.textLabel.text= @"FirstCustomCellText";
return cell;
}
else
{
static NSString *simpleTableIdentifier = @"SimpleTableCell";
SecondCustomCell *cell = (SecondCustomCell *)[tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier];
if (cell == nil)
{
NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"SecondCustomCell" owner:self options:nil];
cell = [nib objectAtIndex:0];
}
cell.textLabel.text= @"SecondCustomCellText";
return cell;
}
}
看起來像一個很好的候選人一個UITableView。 –
爲什麼你的描述是'UITextView'而不是'UILabel'? – rmaddy
我認爲UITableView選項。現在最好的方式來展示真正不同類型的細胞? – BlackBox