我试图将UIWindow子类化为覆盖statusBar以显示某些东西。但是当我的应用程序的方向== 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;
}
答案 0 :(得分:0)
我不认为UIWindows本身实际上是旋转的,而是你添加到窗口的UIViewController是处理旋转的那个。