2010-12-10 71 views

回答

1

在InterfaceBuilder中?

選擇兩個目的,並使用佈局>嵌入對象>查看

配置形成在佈局選項卡來保持中心的視圖。

編程方式

UIView *container = [[[UIView alloc] initWithFrame:CGRectMake(0, 0, 500, 100)] autorelease]; 
UILabel *label = [[[UILabel alloc] initWithFrame:CGRectMake(100, 0, 400, 100)] autorelease]; 
[container addSubview:label]; 
UIActivityIndicatorView *active = [[[UIActivityIndicatorView alloc] initWithFrame:CGRectMake(0, 0, 100 , 100)] autorelease]; 
[container addSubview:active]; 

[theViewController.view addSubview:container; 
container.center = theViewController.view.center; 

雖然你可能想把手保持在標籤和活動指示燈

+0

我怎麼能做到這一點編程? – Jennifer 2010-12-10 18:25:15

+0

請參閱編輯原文... – 2010-12-10 18:43:11

相關問題