Hi all,
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