垂直スクロールビューをtableViewに配置できます。 だけtableViewCellのcontentView、サンプルコードの中にそれを置く:
- (void)viewDidLoad {
[super viewDidLoad];
UITableView* tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStyleGrouped];
tableView.delegate = self;
tableView.dataSource = self;
tableView.frame = CGRectMake(0, 0, self.view.bounds.size.width, self.view.bounds.size.height);
[self.view addSubview:tableView];
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
return 1;
}
-(UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
UITableViewCell* cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:nil];
UIScrollView* sv = [[UIScrollView alloc] init];
CGRect rect = CGRectZero;
rect.size.width = self.view.bounds.size.width;
rect.size.height = 60;
sv.frame = rect;
sv.contentSize = CGSizeMake(1000, 60);
UILabel* label = [[UILabel alloc] init];
label.frame = CGRectMake(0, 0, 900, 30);
label.text = @"hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello ";
label.adjustsFontSizeToFitWidth = true;
[sv addSubview:label];
[cell.contentView addSubview:sv];
return cell;
}