我有表視圖在我的應用程序,每排有長文本,以便它可以滾動整個表,以便用戶可以讀取如何垂直和水平滾動UI tableview?
也是我使用下面的代碼來設置我的手機
整個文本 -
(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
//buttonCount=0;
static NSString *CellIdentifier = @"Cell";
static NSUInteger const kLeftLabel = 100;
static NSUInteger const kRightLabel = 101;
row = [indexPath row];
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil)
{
cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease];
CGRect leftFrame = CGRectMake(2, 5, 45, 30);
CGRect rightFrame = CGRectMake(50, 5, 400, 30);
left = [[[UILabel alloc]initWithFrame:leftFrame]autorelease];
left.tag = kLeftLabel;
left.font = [UIFont systemFontOfSize:13];
[cell.contentView addSubview:left];
right = [[[UILabel alloc]initWithFrame:rightFrame]autorelease];
right.tag=kRightLabel;
right.font = [UIFont systemFontOfSize:13];
[cell.contentView addSubview:right];
}
else {
left = (UILabel*)[cell.contentView viewWithTag:kLeftLabel];
right=(UILabel*)[cell.contentView viewWithTag:kRightLabel];
}
left.text =[secondSplitArrayValue objectAtIndex:row];
right.text=[splitArrayValue objectAtIndex:row];
if (indexPath.row == 0)
{
[cell setSelectionStyle:UITableViewCellSelectionStyleNone ];
}
return cell;
}
通過使用上面的代碼我有兩列所以第一列有小文本,但第二是非常大,閱讀我想滾動水平。
我希望有人能解決這個問題。
預先感謝您
是沒可能無多? – Pooja 2011-03-17 10:37:11
我可以知道你爲什麼不想使用? – Jhaliya 2011-03-17 10:42:28
這種方法要好得多,然後讓tableView滾動到兩邊。如果用戶必須在兩個方向上滾動來閱讀整個文本,這是糟糕的UI設計。考慮製作一個顯示整個文本的細節視圖,使其成爲多行或縮小字體大小 – 2011-03-17 10:45:38