Splash screen template

Discussion in 'iOS Programming' started by sujithkrishnan, Aug 9, 2008.

  1. sujithkrishnan macrumors 6502

    Joined:
    May 9, 2008
    Location:
    Bangalore
    #1
    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.....
     
  2. detz macrumors 65816

    Joined:
    Jun 29, 2007
    #2
    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];
    }
     
  3. sujithkrishnan thread starter macrumors 6502

    Joined:
    May 9, 2008
    Location:
    Bangalore
    #3
    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 ????
     

Share This Page