Note that there are some explanatory texts on larger screens.

plurals
  1. POhow sending message to class works in objective-c
    primarykey
    data
    text
    <p>I am trying to find out how method calls works in objective-c.</p> <p>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.</p> <pre><code>switch(pressed) { case overall: { IPViewController *ipv = [[IPViewController alloc] initWithParam:(IPParam*)p]; [self.view addSubview: ipv.view]; [ipCustomTabbar switchOn:YES]; // &lt;-- here at first attempt } } </code></pre> <p>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.</p> <pre><code>switch(pressed) { case overall: { [ipCustomTabbar switchOn:YES]; // &lt;-- moved here IPViewController *ipv = [[IPViewController alloc] initWithParam:(IPParam*)p]; [self.view addSubview: ipv.view]; } } </code></pre> <p>EDIT: if I comment out the "time-consuming" lines everything is quite fast.</p> <pre><code>switch(pressed) { case overall: { [ipCustomTabbar switchOn:YES]; // &lt;-- only this is fast //IPViewController *ipv = [[IPViewController alloc] initWithParam:(IPParam*)p]; //[self.view addSubview: ipv.view]; } } </code></pre> <p>What am I missing here ?</p> <p>thanks</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload