Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9243941
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T08:55:01+00:00 2026-06-18T08:55:01+00:00

Look at this sample code (in AppDelegate): – (void)showOtherView { if (self.viewController.view == view1)

  • 0

Look at this sample code (in AppDelegate):

- (void)showOtherView {
if (self.viewController.view == view1) {
    self.viewController.view = view2;
} else {
    self.viewController.view = view1;
}
CATransition *animation = [CATransition animation];
[animation setType:kCATransitionMoveIn];
[animation setSubtype:kCATransitionFromRight];
[animation setDuration:0.5];
[animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
[[self.window layer] addAnimation:animation forKey:@"myKey"];

}

This method simply switches view1 to view2. The thing I don’t understand is, that CATransition is declared and added to window.layer after assigning view2 to self.viewController.view. Why does the animation works?

I did set breakpoints and figured out that switching animates after showOtherView method is finished. Why? Just why view2 doesn’t instantly appear on the screen!? (at least for the first time I call this method)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T08:55:02+00:00Added an answer on June 18, 2026 at 8:55 am

    Drawing to the screen is an expensive operation, and Cocoa only does it once per spin of the run loop, at the end. The effects of setting the controller’s view — it getting put on the screen — don’t actually happen until after this method has returned and control passes to the run loop. So whatever configurations you make to the new view will always be shown.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i've a huge problem. Take a look to this sample code private sub FUNCTION1()
Have a look at this code sample or go to the jsfiddle function printRelation(a,
Look at this sample code: <a class=change href=# id=swap01><img src=off.gif></a></div> <a class=change href=# id=swap02><img
I have some html code that look like this sample here : <html> <body>
Look at this sample C code (extracted a test case as an example): main()
Look ath this method of ThreadPoolExcecutor: public void execute(Runnable command) { ... if (runState
look at this code, <head> <meta http-equiv=Content-Type content=text/html; charset=utf-8 /> <script> function change() {
This is the sample code for web services which am trying to implement .
I am learning the boost::lambda library and for that I wrote this sample code
While searching for an answer to this question I found this sample code which

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.