0
我想添加一個UIScrollView在我的TableViewCell。它看起來進行得很順利,但是當我滾動時,標籤從右側進入,它進入單元格上方,但是當文本移動到標籤的左側邊緣時,它就像我想要的那樣消失在標籤後面它來。UIScrollView裏面的UITableViewCell
有什麼建議嗎?
UIScrollView *previewScrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, cell.contentView.frame.size.width, 80.0)];
previewScrollView.backgroundColor = [UIColor clearColor];
[previewScrollView setContentSize:CGSizeMake(500, 60.0)];
previewScrollView.showsHorizontalScrollIndicator = YES;
UILabel *headerLabel = [[UILabel alloc] initWithFrame:CGRectMake(15.0, 3.0, 500.0, 20.0)];
headerLabel.font = [UIFont boldSystemFontOfSize:14.0];
headerLabel.backgroundColor = [UIColor clearColor];
headerLabel.text = @"My long text string that I hope work out ok";
[previewScrollView addSubview:headerLabel];
[[cell contentView] addSubview:previewScrollView];
//[cell addSubview:previewScrollView];
[previewScrollView release];
我正在使用分組的tableview,因此您可以在滾動時在單元格的小可見tableview背景區域上看到文字疊加層。 – Convolution