cell
을 숨기면 UITableView
의 셀을 만질 수 없기 때문에 didSelectRowAtIndexPath
메서드가 작동하지 않습니다. UITableView
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return 50.0f;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *cellIdentifier = @"ScrollCell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
if (!cell) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];
UIScrollView *scroller = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 25, 320, 25)];
scroller.showsHorizontalScrollIndicator = NO;
UILabel *contentLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 320*4, 25)];
contentLabel.backgroundColor = [UIColor clearColor];
contentLabel.textColor = [UIColor whiteColor];
NSMutableString *str = [[NSMutableString alloc] init];
for (NSUInteger i = 0; i < 100; i++) { [str appendFormat:@"%i ", i]; }
contentLabel.text = str;
[scroller addSubview:contentLabel];
scroller.contentSize = contentLabel.frame.size;
[cell addSubview:scroller];
}
return cell;
}
에 함께 scrollView
을 추가 한 다음이 당신을 위해 유용 할 수 있습니다
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
}
를 사용하기위한
쓰기 다음 코드는 링크를 형성한다.