PDA

View Full Version : Splash screen template




sujithkrishnan
Aug 9, 2008, 08:17 AM
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
Aug 9, 2008, 09:29 AM
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:@selector(runLong)
userInfo:nil
repeats:NO];

-(void)runLong{
//do your connection

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

sujithkrishnan
Aug 11, 2008, 02:06 AM
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:@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 ????