2010-12-10 68 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

相关问题