【发布时间】:2012-03-06 11:03:00
【问题描述】:
我尝试继承 UIWindow 以覆盖状态栏以显示某些内容。但是当我的应用的方向 == UIInterfaceOrientationLandscapeLeft 或右时,此自定义窗口不会旋转。我该如何解决?
- (id)init {
if (self = [super initWithFrame:CGRectMake(0, 0, 1024, 20)]) {
self.windowLevel = UIWindowLevelStatusBar;
UILabel *label = [[UILabel alloc] initWithFrame:self.frame];
label.text = @"testing";
label.backgroundColor = [UIColor blackColor];
label.textColor = [UIColor whiteColor];
label.textAlignment = UITextAlignmentCenter;
[self addSubview:label];
NSLog(@"label %@", label);
[label release];
[self makeKeyAndVisible];
}
return self;
}
【问题讨论】: