Iphone - UIView not displayed

Posted by Raphael Pinto on Stack Overflow See other posts from Stack Overflow or by Raphael Pinto
Published on 2010-04-21T09:32:48Z Indexed on 2010/04/21 10:33 UTC
Read the original article Hit count: 313

Filed under:
|

Hi, I have a strange problem with a UIView :

I want to show an Activity Indicator View that I created with Interface Builder to indicate long running activity.

In the viewDidLoad function of my principal viewController I init the ActivityIndicator View like this :

- (void)viewDidLoad {
    [super viewDidLoad];
    appDelegate = (MyAppDelegate *)[[UIApplication sharedApplication] delegate];        
    load = [[ActivityIndicatorViewController alloc] init];
    ...

When I push a button it call this IBAction :

- (IBAction)LaunchButtonPressed{            
    // Show the Activity indicator view.
    [self.view addSubview:load.view];

    // eavy work 
    [self StartWorking];    

    // Hide the loading view.
    [load.view removeFromSuperview];    
}

In the StartWorking function, I ask a request to an internet serveur and parse the XML file that it return me.

The problem is that if I Call my StartWorking function, the application do not start by showing the Activity Indicator view but with the StartWorking function. Whereas if I remove the call to StartWorking function, the view is shown.

Is someone able to explain me why? :s

© Stack Overflow or respective owner

Related posts about iphone

Related posts about activity-indicator