我爲iPhone4開發應用程序& 5.當我使用shouldAutoRotation它只支持iphone4。當我使用willAnimateRotationToInterfaceOrientation時,它僅支持iphone5。我使用iPhone4的兩個方法& 5,它的工作。我要將我的應用發佈到appStore。我收到了一些警告,但會完美地工作。蘋果拒絕應用程序獲取警告。自動旋轉iphone4和iphone5
代碼:
- (BOOL)shouldAutorotate
{
//returns true if want to allow orientation change
return TRUE;
}
- (NSUInteger)supportedInterfaceOrientations
{
//decide number of origination tob supported by Viewcontroller.
return UIInterfaceOrientationMaskAll;
}
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
//from here you Should try to Preferred orientation for ViewController
return UIInterfaceOrientationLandscapeLeft | UIInterfaceOrientationLandscapeRight | UIInterfaceOrientationPortrait;
}
- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation duration:(NSTimeInterval)duration
{
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
if(interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight){
//My code here
}
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
if(interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight){
//My code here
}
return YES;
}
蘋果可能會接受你的應用程序,警告不是錯誤,但它取決於警告的類型,當然......你可以發佈警告嗎?添加行作爲評論belove每行代碼與警告,請... – meronix 2013-04-10 08:34:30
Appstore不會拒絕您的應用程序,但在Objective-C中的警告是重要的,所以嘗試'將警告視爲錯誤' – 2013-04-10 08:45:19
shouldAutorotateToInterface已棄用在ios6 ; UITextAlignmentLeft在ios6中已棄用;這是我的警告 – Ram 2013-04-10 08:46:24