我在這裏有一個問題。所以我想要做的是在分頁的UIScrollView中添加幾個TableView。我有一個名爲CustomView的類,它是UITableView類。它作爲一個表視圖單獨工作。所以它沒有問題。於是,我就加他們這樣在.h文件中:在UIScrollView UITableView
#import <UIKit/UIKit.h>
@interface PagedScrollViewController : UIViewController {
UIScrollView *scrollView;
}
@property (nonatomic, retain) IBOutlet UIScrollView *scrollView;
@end
和.M:
@synthesize scrollView;
- (void)viewDidLoad
{
[super viewDidLoad];
int numberOfPages = 3;
for (int i = 0; i < numberOfPages; i++) {
CGRect frame = CGRectMake(self.scrollView.frame.size.width * i,
0.0,
self.scrollView.frame.size.width,
self.scrollView.frame.size.height);
CustomView *customView = [[CustomView alloc] initWithStyle:UITableViewStyleGrouped];
customView.view.frame = frame;
[self.scrollView addSubview:customView.view];
}
self.scrollView.contentSize = CGSizeMake(self.scrollView.frame.size.width * numberOfPages,
self.scrollView.frame.size.height - self.navigationController.navigationBar.frame.size.height);
}
它顯示只是沒有任何細胞的空表視圖。我究竟做錯了什麼?順便說一句,它在我開始使用故事板之前完美運行。 謝謝,提前。
更重要的是,在iOS 5我在控制檯得到一個SIGABRT: 終止應用程序由於未捕獲的異常 'NSInvalidArgumentException',原因是: ' - [CALayer的numberOfSectionsInTableView:]:無法識別的選擇發送到實例0x6a2fc00'
是啊,我沒在CustomView類 – Noobass