我有一个应用程序,其中包含一个带有两个子视图的滚动视图(在它们之间左右滚动)
两个视图都正确显示,并且视图之间的滚动效果很好。现在我想将第一个视图更改为 TTTableView(由 Three20 提供),但是当我使用 TTCatalog 应用程序中的“TableControlsTestController”类时,我看到的只是一个空的 tableView
请注意,该类包含显示 6 个单元格的所有数据
要添加新的 TTTableView 我使用以下
[scrollView addSubview:detailView.view];
其中 detailView 是 TableControlsTestController 的实例
为了尝试缩小问题所在,我还尝试致电
[self presentModalViewController:detailView animated:YES];
这正确显示了带有 6 个单元格的表格视图。
为什么当我尝试将视图添加到 scrollView 时,这不能按预期工作?
如果您无权访问 TTCatalog 以供参考
#import "TableControlsTestController.h"
///////////////////////////////////////////////////////////////////////////////////////////////////
@implementation TableControlsTestController
///////////////////////////////////////////////////////////////////////////////////////////////////
// NSObject
- (id)init {
if (self = [super init]) {
self.tableViewStyle = UITableViewStyleGrouped;
self.autoresizesForKeyboard = YES;
self.variableHeightRows = YES;
UITextField* textField = [[[UITextField alloc] init] autorelease];
textField.placeholder = @"UITextField";
textField.font = TTSTYLEVAR(font);
UITextField* textField2 = [[[UITextField alloc] init] autorelease];
textField2.font = TTSTYLEVAR(font);
textField2.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;
TTTableControlItem* textFieldItem = [TTTableControlItem itemWithCaption:@"TTTableControlItem"
control:textField2];
UITextView* textView = [[[UITextView alloc] init] autorelease];
textView.text = @"UITextView";
textView.font = TTSTYLEVAR(font);
TTTextEditor* editor = [[[TTTextEditor alloc] init] autorelease];
editor.font = TTSTYLEVAR(font);
editor.backgroundColor = TTSTYLEVAR(backgroundColor);
editor.autoresizesToText = NO;
editor.minNumberOfLines = 3;
editor.placeholder = @"TTTextEditor";
UISwitch* switchy = [[[UISwitch alloc] init] autorelease];
TTTableControlItem* switchItem = [TTTableControlItem itemWithCaption:@"UISwitch" control:switchy];
UISlider* slider = [[[UISlider alloc] init] autorelease];
TTTableControlItem* sliderItem = [TTTableControlItem itemWithCaption:@"UISlider" control:slider];
self.dataSource = [TTListDataSource dataSourceWithObjects:
textField,
editor,
textView,
textFieldItem,
switchItem,
sliderItem,
nil];
}
return self;
}
@end