Re: Fade when changing window's rootViewController possible?

2015-11-25 Thread Ten Horses | Diederik Meijer
Please ignore, managed to solve this 10 minutes after hitting send…



On 7 nov. 2015, at 22:30, Diederik Meijer  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?
> 
> 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 (Cocoa-dev@lists.apple.com)
> 
> 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:
> https://lists.apple.com/mailman/options/cocoa-dev/diederik%40tenhorses.com
> 
> This email sent to diede...@tenhorses.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

SOLVED: Fade when changing window's rootViewController possible?

2015-11-09 Thread Diederik Meijer
This has probably changed then in iOS 8 or 9. It used to be 
splitViewControllers MUST be root and could not be presented modally, see third 
paragraph on this page:

https://developer.apple.com/library/ios/documentation/WindowsViews/Conceptual/ViewControllerCatalog/Chapters/SplitViewControllers.html

"A split view controller must always be the root of any interface you create.”


Anyway, if it can be presented modally now, then, obviously, I don’t have a 
problem anymore, which is sweet!

I set the subject to SOLVED, that should flag it to others as to require no 
more attention.

Thanks again,



Diederik



> Op 9 nov. 2015, om 18:40 heeft David Duncan  het 
> volgende geschreven:
> 
>> 
>> On Nov 7, 2015, at 11:31 PM, Diederik Meijer > > wrote:
>> 
>> 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.
> 
> I’m not aware of any particular reason why a split view controller could not 
> be presented modally. Alternatively you could present the other view 
> controller with no animation and then dismiss it when you want to reveal the 
> split view controller.
> 
>> 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 >> > het volgende geschreven:
>>> 
 
 On Nov 7, 2015, at 1:30 PM, Diederik Meijer >>> > 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 (Cocoa-dev@lists.apple.com 
 )
 
 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:
 https://lists.apple.com/mailman/options/cocoa-dev/david.duncan%40apple.com 
 
 
 This email sent to david.dun...@apple.com 
>>> 
>>> --
>>> David Duncan
>> 
> 
> --
> David Duncan

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Fade when changing window's rootViewController possible?

2015-11-09 Thread David Duncan

> On Nov 7, 2015, at 11:31 PM, Diederik Meijer  wrote:
> 
> 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.

I’m not aware of any particular reason why a split view controller could not be 
presented modally. Alternatively you could present the other view controller 
with no animation and then dismiss it when you want to reveal the split view 
controller.

> 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 > > het volgende geschreven:
>> 
>>> 
>>> On Nov 7, 2015, at 1:30 PM, Diederik Meijer >> > 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 (Cocoa-dev@lists.apple.com 
>>> )
>>> 
>>> 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:
>>> https://lists.apple.com/mailman/options/cocoa-dev/david.duncan%40apple.com 
>>> 
>>> 
>>> This email sent to david.dun...@apple.com 
>> 
>> --
>> David Duncan
> 

--
David Duncan

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Fade when changing window's rootViewController possible?

2015-11-07 Thread Diederik Meijer
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  het 
> volgende geschreven:
> 
>> 
>> On Nov 7, 2015, at 1:30 PM, Diederik Meijer > > 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 (Cocoa-dev@lists.apple.com)
>> 
>> 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:
>> https://lists.apple.com/mailman/options/cocoa-dev/david.duncan%40apple.com 
>> 
>> 
>> This email sent to david.dun...@apple.com 
> 
> --
> David Duncan

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Fade when changing window's rootViewController possible?

2015-11-07 Thread David Duncan

> On Nov 7, 2015, at 1:30 PM, Diederik Meijer  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 (Cocoa-dev@lists.apple.com)
> 
> 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:
> https://lists.apple.com/mailman/options/cocoa-dev/david.duncan%40apple.com
> 
> This email sent to david.dun...@apple.com

--
David Duncan


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Fade when changing window's rootViewController possible?

2015-11-07 Thread Diederik Meijer
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?

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 (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com