我想讓我的項目支持完整的方向。 我上的Xcode 4.2 我的執行給了我一個警告:定位:縱向和橫向在Xcode 4.2
是這樣的代碼:
#import "OrientationTutorialViewController.h"
@implementation OrientationTutorialViewController
@synthesize portraitView, landscapeView;
- (void)viewDidLoad
{
[super viewDidLoad];
[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(orientationChanged:) name:@"UIDeviceOrientationDidChangeNotification" object:nil];
}
- (void) orientationChanged:(id)object
{
UIInterfaceOrientation interfaceOrientation = [[object object] orientation];
if (interfaceOrientation == UIInterfaceOrientationPortrait || interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown)
{
self.view = self.portraitView;
}
else
{
self.view = self.landscapeView;
}
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return YES;
}
- (void)dealloc
{
[super dealloc];
}
@end
有沒有辦法解決這個警告?
可能重複[Xcode:從「枚舉類型uideviceorientation」獲取警告「隱式覆蓋」](http://stackoverflow.com/questions/7015709/xcode-getting-warning-implicit-coversion-from-enumeration-type-uideviceorienta ) –