2012-08-28 50 views
0

如何在不改變視圖的情況下向列表添加列表(TableView),我想在當前視圖中顯示列表,但在視圖中間顯示列表也被顯示。在不改變視圖的情況下將列表添加到視圖

我試着用標籤...但gettign添加tableView而不是標籤的一些問題。

UIView *testView = [[[UIView alloc] initWithFrame:CGRectMake(0,0, 100, 100)autorelease];  
testView.backgroundColor = [[UIColor grayColor] colorWithAlphaComponent:0.2f];   UILabel *label = [[[UILabel alloc] init] autorelease];   
label.text = @"TEST";   
[label sizeToFit]; 
[testView addSubview:label]; 
[self addSubview:testView ]; 

回答

0

,因爲它是按照您的要求,請參閱mjpopupviewcontroller鏈接

+0

感謝的,這是我不understant ......在這個例子中每個視圖的設計自己的XIB文件,如果我不想一起工作xib files..cant我只是添加tableView,然後在事件中'開始',並將其添加到視圖? – vadim

+0

是的,你可以做到這一點是通過拖動,然後去屬性窗口,因爲它具有背景屬性xib的另一個視圖。通過點擊一個彈出窗口將其不透明度設置爲30%。現在整個視圖將像透明一樣,並且它的父視圖可以從中看到。添加你的tableview和其他子視圖。 –

+0

是的我嘗試了我在XIB文件中更改tableView爲框架的一半,但它在所有窗口上打開,我添加它與此代碼(我將它添加到視圖,而不是ViewController,所以我使用的是AppDelegate) :AppDelegate * appDelegate =(AppDelegate *)[[UIApplication sharedApplication] delegate]; DetailViewController * detailViewController = [[DetailViewController alloc] initWithNibName:@「DetailViewController」bundle:nil]; – vadim

相關問題