このチュートリアルに従って、カスタムの「パルス スタイル」UITableView に取り組んでおり、すべてが順調に進んでいます。いくつかの変更と拡張を行いましたが、実装したい機能が 1 つあります。それは、水平方向のバウンス領域の色です。
これは、テーブル ビューを含むセルを作成する方法です。
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
NSString *cellIdentifier = [@"TableViewCell" stringByAppendingFormat:@"%i", self.content.indexInArrayOfViews];
UIView *view = [self.content viewAtIndex:indexPath.row];
UITableViewCell *cell = [self.horizontalTableView dequeueReusableCellWithIdentifier:cellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:cellIdentifier] autorelease];
view.center = CGPointMake(view.center.y,view.center.x);
view.contentMode = UIViewContentModeCenter;
view.transform = CGAffineTransformMakeRotation(M_PI_2);
cell.selectionStyle = UITableViewCellSelectionStyleNone;
}
[cell addSubview:view];
return cell;
}
セルの再利用の問題があることは承知していますが、今のところ、この色を変更したいと思います [IMG] .
垂直方向のテーブル ビューのバウンス領域の色を制御できますが、水平方向のビューでこの成功を再現するのに苦労しています。
これは私が垂直に行う方法です:
CGRect frame = self.tableView.bounds;
frame.origin.y = -frame.size.height;
UIView* topBack = [[UIView alloc] initWithFrame:frame];
topBack.backgroundColor = [self.delegate backgroundColorForTopOfTableView];
[self.tableView addSubview:topBack];
[topBack release];
これは、この StackOverflow の質問によるものでした。
水平テーブル ビュー (テーブル ビュー セルにネストされている) の色/背景を変更するにはどうすればよいですか?