• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Fade when changing window's rootViewController possible?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Fade when changing window's rootViewController possible?


  • Subject: Re: Fade when changing window's rootViewController possible?
  • From: Diederik Meijer <email@hidden>
  • Date: Sun, 08 Nov 2015 08:31:46 +0100

Thank you David,

I forgot to mention that one of them is a UISplitViewController and - unless this has changed - that one can not be presented modally. It is for this reason that I want to switch the window’s rootViewController. Otherwise, a plain presentViewController would definitely make a lot more sense :-)

This is what I actually found briefly after sending the question (method edited for my app’s specifics and original code found not in a separate method).

Method added to appDelegate:

-(void)switchWindowRootVCTo:(NSString *)newVCString {
    id newVC = nil;
    if ([newVCString isEqual:@"UISplitViewController"]) newVC = self.svc;
    else if ([newVCString isEqual:@"THWelcomeVC"]) newVC = self.wvc;
    self.window.rootViewController = newVC;
    [UIView transitionWithView:self.window
		duration:0.50
		options:UIViewAnimationOptionTransitionCrossDissolve animations:^{
			self.window.rootViewController = newVC;
		}
		completion:nil];
}

So both the old and the new root VC are properties of the appDelegate (self.svc and self.wvc respectively) and they are both initialized in applicationDidiFinishLaunching.

Each of them can call the above method of the app delegate and trigger the switch.


Best regards,



Diederik



> Op 8 nov. 2015, om 04:36 heeft David Duncan <email@hidden> het volgende geschreven:
>
>>
>> On Nov 7, 2015, at 1:30 PM, Diederik Meijer <email@hidden <mailto:email@hidden>> wrote:
>>
>> Dear list,
>>
>> Is it possible to change an iOS app window’s rootViewController at runtime and have a fade animation between the two states happen?
>
> Not trivially, but you can do this trivially by presenting your “replacement” view controller modally, which is also the more supported path (by far).
>
>>
>> Obviously there is no modal or push presentation, the view is just replaced by a new one. For this reason a fade between the two would be nice.
>>
>> This is for iOS 8 and up, coding in Objective-C.
>>
>>
>> Many thanks,
>>
>>
>>
>> Diederik
>>
>>
>>
>> _______________________________________________
>>
>> Cocoa-dev mailing list (email@hidden)
>>
>> Please do not post admin requests or moderator comments to the list.
>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>>
>> Help/Unsubscribe/Update your Subscription:
>>
>> This email sent to email@hidden <mailto:email@hidden>
>
> --
> David Duncan

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


  • Follow-Ups:
    • Re: Fade when changing window's rootViewController possible?
      • From: David Duncan <email@hidden>
References: 
 >Fade when changing window's rootViewController possible? (From: Diederik Meijer <email@hidden>)
 >Re: Fade when changing window's rootViewController possible? (From: David Duncan <email@hidden>)

  • Prev by Date: Re: Fade when changing window's rootViewController possible?
  • Next by Date: SOLVED: 'barHideOnSwipeGestureRecognizer' works with two UIScrollViews but not with two others
  • Previous by thread: Re: Fade when changing window's rootViewController possible?
  • Next by thread: Re: Fade when changing window's rootViewController possible?
  • Index(es):
    • Date
    • Thread