Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

sujithkrishnan

macrumors 6502
Original poster
May 9, 2008
265
0
Bangalore
Hi all.

In my iPhone app, i am contacting server in some intervals.
For that i want a splash screen (say Loading... Please wait...) ...

I tried with a method which will show the alertView with activityIndiactor. And i called this method as a thread (using method NSThread detach...)

Flow is like this,...

in mainthread
detach a thread which will show loading in alertView

check whether i want go connect to server or not
if YES, connect and get data
else use local data

if data is ready
dismiss the alertView

add subviews, tabbarcontrollers etc... to windows
make Window key and visible

But the thing is that this thread is showing some leaks...

Also sometimes the alertView is not dismissing....

(I doubt it happen when the thread is starting, after the execution of line which will dismiss alertView.. )

If i am contacting server, alertView is properly dismissing
If not (means i am reaching the dismiss line fastly..alertView is not dismissing)....

Please help me with a common template.....
 

detz

macrumors 65816
Jun 29, 2007
1,051
0
Just create a new UIView or UIImageView and do something like.

//Show the other view..

[mainView removeFromSuperview];
[window addSubview:waitView];

[NSTimer scheduledTimerWithTimeInterval:(0.1)
target:self
selector:mad:selector(runLong)
userInfo:nil
repeats:NO];

-(void)runLong{
//do your connection

[waitView removeFromSuperview];
[window addSubview:mainView];
}
 

sujithkrishnan

macrumors 6502
Original poster
May 9, 2008
265
0
Bangalore
Just create a new UIView or UIImageView and do something like.

//Show the other view..

[mainView removeFromSuperview];
[window addSubview:waitView];

[NSTimer scheduledTimerWithTimeInterval:(0.1)
target:self
selector:mad:selector(runLong)
userInfo:nil
repeats:NO];

-(void)runLong{
//do your connection

[waitView removeFromSuperview];
[window addSubview:mainView];
}

Okie...But i didnt worked with timer....

So whether the background downloading takes place parallely with timer job??

Or i want again a thread to do this ????
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.