I need to add a short splash-screen to my app, which appears even when the app is launched from multitasking.
I have managed to do so, popping an UIImageView up and fading it out after a couple of seconds form the - (void)applicationWillEnterForeground:(UIApplication *)application method in my app delegate.
However when launching from multitasking, while it appears and works fairly well, sometimes there a short delay before the image pops up and so you briefly see the view behind it.
How can I overcome this?
Thanks.
ok, now I understand -
then you may try to use
- (void)applicationDidBecomeActive:(UIApplication *)application
If I understand correctly you're just trying to create a launch image right? So in that case you would simply go into your info-plist in Supporting Files then highlight one of the items and press the "+" icon. Select "Launch Image" from the drag down menu, and type the name of your image into the text box next to "Launch Image".
Try this.
Create a reference (a strong reference if using ARC) to the view, so you hold it. Then create the view anywhere in the program really (I guess at first start would be good). Then, when you return from multitasking, you don't need to create a new view (which might take time), you only push the view that you already have set up in-memory.
Assuming you don't do this already, it should significantly shorten (or remove) the delay you're seeing.
Also, don't forget to set animated: to NO
Related
In one of my apps, when I try to edit (type some text) UITextField, UITextView or any other 'text-able' UIControl the cursor just blinks but no characters are typed in except BACKSPACE (possible only when I have some initial text in it), RETURN and switching character types. This goes to all controls across whole application.
Summary:
It happens only from iOS 6.0 (does not occur on iOS 5.x, 4.x neither Simulator or real device)
All delegate methods are fired (shouldBeginEditing: didBeginEditing:) except shouldChangeCharactersInRange:
isFirstResponder flag is behaving set correctly (shouldBeginEditing: logs NO, while didBeginEditing: logs YES correctly). It is also tested using logs that THE firstResponder IS the one already edited.
It repairs itself after any UIAlertView is presented to the user and dismissed. It doesn't matter if this alert is shown on the same screen (UIViewController view) or any other.
I have no idea how to even approach or debug this.
Where should I look for hints? Any experts of tracking responder chain related issues etc.?
How can I track down the UIAlertView's effect on the issue?
Depending on your implementation it's either the makeKeyAndVisible method of the UIWindow class that you forgot to call inside the - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions method of the application delegate or corresponding Visible at Launch flag in your main interface xib file.
Cheers... :)
in my case, there is a 'visible at launch' on the main window, it was unchecked, which works on iOS5 only, needs to check it to make it working on iOS6.
In my situation I had an activity indicator that would pop up over the main window during periods of background activity. In this case the activity indicator view had its own window that was set to UIWindowLevelAlert. I was inadvertently calling makeKeyAndVisible on this window. Later on I would call resignKeyWindow. This used to work on iOS 4 and 5 but no longer worked in iOS 6. I discovered that this was not technically necessary as simply using window.hidden = Y/N worked just as well.
In my case I moved becomeFirstResponder for my UITextField from ViewDidLoad to ViewDidAppear and this solved my problem.
I have a viewcontroller with four (4) AVPlayers (with AVPlayerLayers like APPLE example).
If I pop this viewcontroller and the push a new instance of the same type. I'm not able to play video in one or two AVPlayers. No errors and code runs fine, AVPlayerLayers also says it has a superLayer.
And to the most strange thing if I push home button, coming back to springboard and the enter the app all video players like magic start playing. It's like it rerender the view tree or something.
Any hints or clues?
PS. I wait for assets to be ready using loadValuesAsynchronouslyForKeys.
We had a similar problem. Following answer lead to the solution:
AVplayer not showing in ScrollView after 2-3 times
You have to call: [AVPlayer replaceCurrentItemWithPlayerItem:nil]; when your viewcontroller gets unloaded. This might be tricky as you might have added an observer or used addBoundaryTimeObserverForTimes:queue:usingBlock:
Also you have to be careful when checking agaings superlayer: Better check against uiview.window when determing whether your view is still attached to the view hierarchy.
yours
phil
What is the first method that gets called in the UIApplication Delegate? I have included a launch image in my application, and I would like to get a head start on downloading some data while that screen is still up, before my actual views appear. Should I be looking to place these calls in the delegate, or where is the first place I should think about making these calls?
- (void)applicationDidFinishLaunching:(UIApplication *)application
gets called first.
EDIT:
Your Default.png appears for short time when the app is launched. You cannot rely on this short time to do some processing.
You can show your first view with a message that download is in process (with the help of activity indicator view)
Consider the First answer(as - (void)applicationDidFinishLaunching:(UIApplication *)application called at all first), BUT if you want to display your downloaded image on your first view, then implement some delay (BY Timer or something till your image download), and yeah don't forgot to implement an in between screen with activity initializar(otherwise your application will seem like hanged).
I have a question or two about using AVFoundationFramework in XCode.
I downloaded AVCamDemo source code. I am trying to leverage the code in my app to replace UIImagePickerController (because it is slow) with the AVFF functionality. However, I cannot figure out how to exit the AVFF code when "Done" button is tapped in the UI. My app will provide the Done button.
Specifically, I need to know:
What do i need to stop the capture session? Just [session stopRunning] ??
My app's ViewController will invoke the AVFF, and will provide the "Done" button in the view controller that I will create for the AVFF functionality. When the user taps the "Done" button, I need to stop the capture process and exit back to my app. I am not sure how this can be done.
Any help will be highly appreciated.
Regards, Sam.
Yes. Although you may also want to ensure you turn the video torch off if you had turned it on, and if you called lockForConfiguration on the device you should be sure to unlock it.
There is no "exiting". If you presented your view controller using presentModalViewController:animated:, use dismissModalViewControllerAnimated:. If you pushed it onto a UINavigationController, pop it back off. If you did it some other way, dismiss it in the way appropriate for that method.
regarding your question on AVFoundationFramework:
I don't exactly understand what you are not succeeding to do. Some general options:
[session stop] will stop capturing.
You can play with the AVCaptureVideoPreviewLayer layer - that's what actually shows the camera preview.
All the ui code is in AVCamViewController - so you can just pop it from the stack, or remove it from superview - which ever is correct in your code.
If these don't help, please try to elaborate further on the problem, and perhaps supply some code.
Cheers,
Oded.
This is probably some rookie mistake, but I can't figure it out. I've established a button within my app to recall a link in safari. From my method file it looks like this:
Obj C Code:
-(IBAction)linkSafari{
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"http://en.wikipedia.org/"]];
}
I linked it up in IB and all seems okay.
When I create this same setup as a single view app it works great, but whenever I click it in my multiview app it's an automatic crash. Acts the same way on both my simulator and physical ipod.
Is there an endless list of places I could have screwed up or is there a certain area I should look into?
I don't think the problem is in that particular function,
but on the way you create the views and viewcontrollers
For anyone interested, this was solved thanks to an extra set of eyes. On my tab bar, I'd declared the assigned nibs for every section, but missed a few class associations. That's what messed me up.