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 3218786
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T15:34:07+00:00 2026-05-17T15:34:07+00:00

I am trying to find out how method calls works in objective-c. I have

  • 0

I am trying to find out how method calls works in objective-c.

I have a simple line of code in an iPhone app, wich is changing the appearance of a view, and then a view controller is called and attached to the main view.

switch(pressed) {

   case overall: {
      IPViewController *ipv = [[IPViewController alloc] initWithParam:(IPParam*)p]; 
      [self.view addSubview: ipv.view];
      [ipCustomTabbar switchOn:YES]; // <-- here at first attempt
   }
}

It happens that the allocation of ipv is quite time consuming, so the appearance of the ipCustomTabbar get changed after a bit. So I decided to move the ipCustomTabbar at first.
But with my surprise I found that that the behaviour is not changed at all. The ipCustomTabbar is not changed until the ipv is initialized and attached to view.
I was expecting that the first thing was a call/message on switchOn then execute the rest of the flow.

switch(pressed) {

   case overall: {
      [ipCustomTabbar switchOn:YES]; // <-- moved here 
      IPViewController *ipv = [[IPViewController alloc] initWithParam:(IPParam*)p]; 
      [self.view addSubview: ipv.view];
   }
}

EDIT:
if I comment out the “time-consuming” lines everything is quite fast.

switch(pressed) {

   case overall: {
      [ipCustomTabbar switchOn:YES]; // <-- only this is fast 
      //IPViewController *ipv = [[IPViewController alloc] initWithParam:(IPParam*)p]; 
      //[self.view addSubview: ipv.view];
   }
}

What am I missing here ?

thanks

  • 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-05-17T15:34:08+00:00Added an answer on May 17, 2026 at 3:34 pm

    Am I correct in assuming that [ipCustomTabbar switchOn:YES] changes the appearance of the view and you want it to happen straight away instead of waiting for the processing in -initWithParam: to finish.

    The problem is in the way drawing is handled. Changing the state of a view object does not necessarily cause the drawing to be done straight away. Usually what happens is that a change of state of a view invalidates the view and puts it on Cocoa’s list of things that need to be redrawn. The actual; drawing only occurs later and since it happens on the main thread, that will be after the processing of your event finishes including initialisation of your view controller.

    What you need to do is avoid doing lengthy processing on the main thread as much as possible. You should consider moving the lengthy processing in the -initWithParam: method onto a different thread. It sounds like it’s an ideal candidate for NSOperation.

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

Sidebar

Related Questions

I'm trying to find out a little bit more about how the preprocessor works
I find my self out of ideas trying to get this app to work.
I'm trying to find out if there are any methods in Java which would
I'm tring to find out a way to get the complete method signature that
Trying to find out if it's possible to use SQLAlchemy on Heroku. Thanks.
I trying to find out the visibility of the Excel and do some activities
I am trying to find out how to write an SQL statement that will
i m trying to find out how to convert timestamp date and time (
I am trying to find out a way to set a time tag to
I am trying to find out if an instance of an application (not vb.net)

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.