水平表视图(在TableViewCell内)不响应滚动

我已经实现了UITableViewCell的一个自定义子类,使得每个单元格都包含一个表格视图。

#import <UIKit/UIKit.h> @interface CustomTableViewCell : UITableViewCell <UITableViewDataSource>{ UITableView *_horizontalTableView; } @property (nonatomic, retain) UITableView *horizontalTableView; @end #import "CustomTableViewCell.h" @implementation CustomTableViewCell @synthesize horizontalTableView; int kCellHeight = 80; int kCellWidth = 50; int kTableLength = 300; int kRowHorizontalPadding = 10; int kRowVerticalPadding = 10; - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { if ((self = [super initWithStyle:style reuseIdentifier:reuseIdentifier])) { self.horizontalTableView = [[[UITableView alloc] initWithFrame:CGRectMake(0, 0, kCellHeight, kTableLength)] autorelease]; self.horizontalTableView.transform = CGAffineTransformMakeRotation(-M_PI * 0.5); [self.horizontalTableView setFrame:CGRectMake(kRowHorizontalPadding * 0.5, kRowVerticalPadding * 0.5, kTableLength - kRowHorizontalPadding, kCellHeight)]; self.horizontalTableView.rowHeight = kCellWidth; self.horizontalTableView.backgroundColor = [UIColor greenColor]; self.horizontalTableView.separatorStyle = UITableViewCellSeparatorStyleSingleLine; self.horizontalTableView.separatorColor = [UIColor blueColor]; self.horizontalTableView.dataSource = self; [self addSubview:self.horizontalTableView]; } return self; } 

水平表视图是可见的,但水平滚动没有启用 。 我只能垂直滚动,而不能水平滚动。 我怎样才能克服呢?

在这里输入图像说明