【发布时间】:2011-08-15 17:11:38
【问题描述】:
我有一个 UISplitViewController 并试图在右视图控制器中居中(水平和垂直)一个 UILabel。当它以纵向加载时,标签看起来正确,但如果将其旋转为横向,则标签不再垂直居中。我正在使用:
CGSize size = self.view.frame.size;
UILabel *noResults = [[UILabel alloc] initWithFrame:CGRectMake(0, 40.0f, size.width, size.height)];
noResults.text = @"No people were found.";
noResults.textColor = [UIColor blackColor];
noResults.textAlignment = UITextAlignmentCenter;
noResults.backgroundColor = [UIColor clearColor];
noResults.textColor = [UIColor darkGrayColor];
noResults.font = [UIFont systemFontOfSize:16.0];
noResults.shadowColor = [UIColor whiteColor];
noResults.shadowOffset = CGSizeMake(0, 1);
noResults.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
self.noResultsLabel = noResults;
[self.view addSubview:noResultsLabel];
[noResults release];
我认为当我使用自动调整大小蒙版时它会自动调整大小?
【问题讨论】:
标签: ios ipad uilabel uisplitviewcontroller