我在 iOS5 的主-详细信息应用程序模板的详细视图中间将 UIView 居中时遇到问题。视图的宽度小于 iPad 屏幕,无论设备方向如何,它都应始终显示在中心。这是我尝试过的......
- (void)viewDidLoad
{
[super viewDidLoad];
[self.view setAutoresizingMask:(UIViewAutoresizingFlexibleLeftMargin|UIViewAutoresizingFlexibleRightMargin)];
[self.view.layer setBorderWidth:2.0F];
[self.view.layer setBorderColor:[[UIColor orangeColor] CGColor]];
// Do any additional setup after loading the view, typically from a nib.
UIView *someContainerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 600.0F, 56.0F)];
[someContainerView.layer setBorderWidth:2.0F];
[someContainerView.layer setBorderColor:[[UIColor greenColor] CGColor]];
[someContainerView setAutoresizingMask:(UIViewAutoresizingFlexibleLeftMargin|UIViewAutoresizingFlexibleRightMargin)];
[self.view addSubview:someContainerView];
[self configureView];
}
这是视图的显示方式
有人能告诉我我在这里想念什么吗???