2014-09-10 3 views
7

में काम नहीं कर रहा है मेरे पास नीचे की संरचना है।
एकाधिक इंटरफ़ेस का समर्थन करना लेकिन होम स्क्रीन में एकल इंटरफ़ेस आईओएस 8 + आईफोन

HomeView(Support only portrait mode) 
| 
| 
V 
View1(Support all orientation) 
| 
| 
V 
View2(Support all orientation) 

समस्या:
जब मैं popToRootViewController विधि को फोन करके HomeView करने के लिए coming back from View2(Landscape mode) हूँ, यह App_Delegate और प्रदर्शन HomeView की supportedInterfaceOrientationsForWindow विधि landscape mode में फोन नहीं किया।

छवि:

enter image description here

नोट:
यही बात नहीं होता है जब मैं popToRootViewController विधि को फोन करके View1 (लैंडस्केप मोड) HomeView करने से वापस आ यह supportedInterfaceOrientationsForWindow फोन करेगा और सब महान काम करता है।
यदि मैं आईओएस 7 में एक्सकोड 6 का उपयोग कर ऐप चलाता हूं तो सभी बेहतरीन काम करते हैं।

I read below question but it did not help me
How to maintain presenting view controller's orientation when dismissing modal view controller?

ऊपर के लिंक matt में कहा कि iOS8 stop support for friezing orientation, लेकिन मैं apple document में यह भी नहीं मिला है, तो आप यह परिवर्तन साझा करें के बारे में कोई reference link है।

प्रश्न:
1] क्यों प्रतिनिधि विधि supportedInterfaceOrientationsForWindow बुला नहीं है।
2] क्या समर्थन एकल अभिविन्यास के साथ एक दृश्य होना संभव है और अन्य सभी सभी अभिविन्यास का समर्थन करेंगे।

धन्यवाद

उत्तर

3

मैं इसे और पोस्ट जवाब का समाधान के रूप में यह कुछ एक

समस्या में मदद मिल सकती देगा:
मैं supportedInterfaceOrientationsForWindow में कोड के नीचे है।

- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window 
{ 
    // Suport only portrait mode for home screen 
    if([self.navigationController.topViewController isKindOfClass:[ViewHome class]]) 

    { 
     return UIInterfaceOrientationMaskPortrait; 
    } 
    return UIInterfaceOrientationMaskAll; 
} 

लेकिन delegate विधि supportedInterfaceOrientationsForWindow नहीं कहा जब उपयोग popToRootViewControllerAnimated विधि जब वहाँ more then two view Cotnrollers ढेर में मौजूद है।

समाधान:
चरण 1: नेविगेशन नियंत्रक के उप वर्ग बनाएँ।

चरण 2: ओवरराइड विधि popToRootViewController नीचे // कोड को ओवरराइट करें // सुपर क्लास विधि popToRootViewController को ओवरराइट करें।

-(NSArray*)popToRootViewControllerAnimated:(BOOL)animated 
{ 
    // Only for iOS8 and above 
    if (floor(NSFoundationVersionNumber) > NSFoundationVersionNumber_iOS_7_1) 
    { 
     // Array which will contaimn all poped view controllers object. 
     NSMutableArray *popedControllersArray = [[NSMutableArray alloc] init]; 

     // Tmp created controllers object 
     NSArray *controllers; 

     // Hold first view cotnrollers. 
     UIViewController *firstViewController = [self.viewControllers objectAtIndex:1]; 

     // Pop to first view controllers with no animation. 
     controllers = [super popToViewController:firstViewController animated:NO]; 

     // Add poped view cotnrollers objects to the array. 
     [popedControllersArray addObjectsFromArray:controllers]; 

     // Pop to root view controller with animation 
     [super popViewControllerAnimated:YES]; 

     // Add first view controller object as it is poped by above line. 
     [popedControllersArray addObject:firstViewController]; 

     // return poped view controllers object. 
     return popedControllersArray; 
    } 
    else 
    { 
     // Called super view popToRootViewControllerAnimated method and return popped 
     // view controllers array. 
     return [super popToRootViewControllerAnimated:animated]; 
    } 
} 


कृपया कोई टिप्पणी के लिए मुफ्त भरने और किसी भी सवाल के लिए कहें।

+0

क्या यह आईओएस 8 में एक बदलाव है कि "प्रतिनिधि विधि समर्थित इंटरफेसऑरिएंटेशंसफोरविंडो को तब नहीं कहा जाता है जब हम नेविगेशन नियंत्रक स्टैक में दो से अधिक व्यू कंट्रोलर होने पर popToRootViewControllerAnimated विधि का उपयोग करते हैं"? –

+1

मैं क्या कह सकता है, यह iOS8 में एक बग है यह supprtedInterfaceOrientationsForWindow विधि कॉल करना होगा लेकिन ऐसा नहीं किया। – Jageen

+0

मैं आईओएस 8. में एक और उन्मुखीकरण संबंधित मुद्दा है अगर आप इस सवाल का http://stackoverflow.com/questions/26357162/how-to-force-view-controller-orientation-in-ios पर दिखाई दे सकता है बहुत मददगार होगा -8? noredirect = 1 # comment41375612_26357162 और अपनी प्रतिक्रिया साझा। –

संबंधित मुद्दे