我重新更新完全我的問題與所有細節更多理解!如何以編程方式聲明並顯示我的UITableView?
因爲他們說圖片不僅僅是文字,我還讓你做了一個小樣本來詳細解釋一切!
首先,我在文中解釋。
我有這樣的:
- 1 MasterViewController =(RootViewController的)
- 1的firstView = UITableView中(將顯示與數據許多定製單元)
- 2 SecondView = UIView的
- 3 ThirdView = UIView
現在圖片/樣機:
在我MasterViewController.h(代碼一部分)
@property (strong, nonatomic) FirstView *firstView;
@property (strong, nonatomic) SecondView *secondView;
@property (strong, nonatomic) ThirdView *thirdView;
在我MasterViewController.m(代碼一部分)
firstView = [[LastSalesView alloc] initWithFrame:CGRectMake(0.0, 0.0, result.width, result.height)];
firstView.backgroundColor = [UIColor clearColor];
firstView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
[bottomContainerView addSubview:firstView];
[firstView setHidden:NO];
secondView = [[LastSalesView alloc] initWithFrame:CGRectMake(0.0, 0.0, result.width, result.height)];
secondView.backgroundColor = [UIColor clearColor];
secondView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
[bottomContainerView addSubview:secondView];
[secondView setHidden:NO];
thirdView = [[LastSalesView alloc] initWithFrame:CGRectMake(0.0, 0.0, result.width, result.height)];
thirdView.backgroundColor = [UIColor clearColor];
thirdView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
[bottomContainerView addSubview:thirdView];
[thirdView setHidden:NO];
-(void)viewFirstPage:(id)sender {
NSLog(@"button first pushed");
[firstView setHidden:NO];
[secondView setHidden:YES];
[thirdView setHidden:YES];
}
-(void)viewSecondPage:(id)sender {
NSLog(@"button second pushed");
[firstView setHidden:YES];
[secondView setHidden:NO];
[thirdView setHidden:YES];
}
-(void)viewThirdPage:(id)sender {
NSLog(@"button third pushed");
[firstView setHidden:YES];
[secondView setHidden:YES];
[thirdView setHidden:NO];
}
你爲什麼子類的UITableView?我認爲沒有必要這樣做。 – BergQuester
我是新手,我不明白你的問題的含義!我傾向於回答我需要我創建我的UITableView,對吧? – GilbertOOl
啊,知道了。你的代碼肯定反映了一個新手。這裏有太多的錯誤來真正理順它。沒關係,它是一個新手。隨着時間的推移,我相信你會學習。我建議你通過這個[UITableView教程]工作(http://www.appcoda.com/ios-programming-tutorial-create-a-simple-table-view-app/)。 – BergQuester