Ads as a loading screen

Discussion in 'iOS Programming' started by spiderguy84, Jun 28, 2010.

Thread Status:
Not open for further replies.
  1. spiderguy84 macrumors regular

    Joined:
    Nov 12, 2009
    #1
    How can I take the splash loading screen, usually Default.png, into something that will show the iad banner on it, forcing users to view an ad for 3 or 4 seconds before opening my app?
     
  2. jared_kipe macrumors 68030

    jared_kipe

    Joined:
    Dec 8, 2003
    Location:
    Seattle
    #2
    Your app takes 3 or 4 seconds to load?!

    First of all, the Default.png is displayed by the OS while it waits for you to finish loading. It isn't a view that you have direct control over, so you cannot do this.

    Second of all, I'm not sure you grasp the way ADBannerView works, since it won't display anything for a second or two while it connects to a server and gets add content.


    If you really want to display a splash screen with an ad, you are going to have to hardcode the ad onto your Default.png. Meaning you won't be able to change your ad without submitting a new binary and you'll have to sell/track the revenue some other way.
     
  3. HarryWorksInc macrumors regular

    Joined:
    Feb 21, 2010
    #3
    1. you can tell you splash screen to hold for a little while.

    2. You can tell a view with you own ad to show for a few seconds after launch

    although you can display an ad it must be your own. The iAds can only be displayed in a 320*50 or 480*32 format.

    If you are a paid developer i suggest you check out the WWDC videos from this year they have a few on iAds.
     
  4. jared_kipe macrumors 68030

    jared_kipe

    Joined:
    Dec 8, 2003
    Location:
    Seattle
    #4
    1. You do not have control over the contents of the view, other than making the png file in the first place.

    2. ... "Tell a view with your own ad to show for a few seconds after launch" I suppose so, but you would still have to hardcode in the ad contents (unless you wanted to make the user view a blank or default add while you fetch something from the network). You CANNOT have an ADBannerView showing while it has no content, at least not if you want to have it on the store. And you are correct, there are very limited size constraints on iAd views.
     
  5. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #5
    You can't, really. And even if you could, please don't. :)
     
  6. HarryWorksInc macrumors regular

    Joined:
    Feb 21, 2010
    #6
    What i meant was that you could load a view and have an NSTimer for 3-4 seconds to close it within that view you could create links and animations to create an appealing and working ad.
     
  7. jared_kipe macrumors 68030

    jared_kipe

    Joined:
    Dec 8, 2003
    Location:
    Seattle
    #7
    Actually now I'm curious, how can you tell the splash screen to hold for a defined amount of time? Without sleeping on the main thread or something...
     
  8. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #8
    There are a number of possible solutions to achieve this end. The real question is: why would you want to delay your users from using your app?
     
  9. jared_kipe macrumors 68030

    jared_kipe

    Joined:
    Dec 8, 2003
    Location:
    Seattle
    #9
    Depends, a tenth of a second of having it up while I do something in the background might aleviate an annoying graphical bug I am experiencing with iOS4 (that wasn't in the previous builds)

    So if there are so many ways, what are the most common?
     
  10. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #10
    The Default.png doesn't go away until [window makeKeyAndVisible] is called in application:didFinishLaunchingWithOptions:. I'd start by seeing what you could do before that call.

    Curious, though: What is this graphical bug you are encountering? Perhaps there's a better way than splash-screen-tweaking to address the issue.
     
  11. jared_kipe macrumors 68030

    jared_kipe

    Joined:
    Dec 8, 2003
    Location:
    Seattle
    #11
    I don't have that call in my applicationDelegate, so unfortunately that doesn't help and probably wouldn't help.

    Basically in previous versions of the SDK when apple sent the notification UIKeyboardWillShowNotification they had already created the keyboard view and were about to animate it onto the screen.

    So I could just set its hidden property to YES and I would never see it.

    NOW when apple does this they have either not created it, or they haven't added it to the view hierarchy so I can't find it yet, and thus my only good way of hiding the keyboard is to fire an NSTimer when I receive the notification and then hide the keyboard. No matter how small I make the NSTimer, I still see the keyboard START to animate up before it disappears.
     
  12. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #12
    Really? What does your application:didFinishLaunchingWithOptions: look like then?

    Your app pops up the keyboard on startup (and you've coded to avoid that)? Why would it try to do that?
     
  13. jared_kipe macrumors 68030

    jared_kipe

    Joined:
    Dec 8, 2003
    Location:
    Seattle
    #13
    Nevermind I think I have just come up with a great way around it by looking at the documentation for UIResponder.

    The reason I want this is because my UI has a very specific keyboard already displayed, kinda like a calculator. But I wanted to use a UITextView to enter my data into without the keyboard.... meaning I could still use the copy and paste functionality just insert commands on my own.

    Please see http://www.youtube.com/watch?v=DnwHzT7BLjs for a overview of my app. What you don't see in the video is that I have a way to pull back up the keyboard if you need to enter text into the field.

    As of 3.2 UIResponder subclasses have a property inputView that is initially nil. If you set it to a blank view it essentially does what I want, however setting it back to nil doesn't make the original keyboard come back.
    This is why I initially rejected this approach when fixing my app up for iOS 4.

    I have found a method in UIResponder -reloadInputViews which will bring back the normal keyboard if you call is after setting the inputView property back to nil.
     
  14. jared_kipe macrumors 68030

    jared_kipe

    Joined:
    Dec 8, 2003
    Location:
    Seattle
    #14
    Code:
    - (void)applicationDidFinishLaunching:(UIApplication *)application {
        // Add the tab bar controller's current view as a subview of the window
        [window addSubview:tabBarController.view];
    }
    
     
  15. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #15
    So, where is your window ever made visible?
     
  16. jared_kipe macrumors 68030

    jared_kipe

    Joined:
    Dec 8, 2003
    Location:
    Seattle
    #16
    Through the grace of .xib files?
     
  17. HarryWorksInc macrumors regular

    Joined:
    Feb 21, 2010
    #17
    The simplist way (in my opinion to keep the splash screen up is to put
    HTML:
    sleep(3);
    right after the
    HTML:
    - (void)applicationDidFinishLaunching:(UIApplication *)application
    is called so before the main view is added as a subview to the main window. ei.
    HTML:
    [window addSubview:[mainViewController view]];
     
  18. rossipoo macrumors regular

    Joined:
    Jun 7, 2009
    #18
    If you want to display a dynamic, iAd while loading the app, you'll have to load all your data in the background. Only load what you need for the ad during initial startup, which should only be about a second. Then while you display the ad, and maybe a loading bar or something, in the background you load the rest of the app. When it's loaded, you simply display a "continue" button.
     
Thread Status:
Not open for further replies.

Share This Page