Swift: Animation code on LaunchScreen [duplicate] - ios

This question already has answers here:
iOS Launch screen code not running
(2 answers)
Closed 5 years ago.
I want to rotate an app logo on my Launch Screen (LaunchScreen.storyboard).
This link helps me in getting the code to rotate an image. However, where can I put this code?
Since there is no class file associated with the Launch Screen, how can I acheive this?

You can't directly do that as the launch screen is static. Even if it's set up via a .xib or a storyboard file, it will appear as a snapshot of the initial state of that scene.
You should create a view controller with the same look as your launch screen and animate that.

You can't achieve that. Before LaunchScreen.storyboard you was putting only static images in order to be shown on launch. LaunchScreen.storyboard is introduced later to simplify the generation of static images.
But you can kind of workaround it. You display exactly same looking view controller just after launchscreen and run animation. But there will be a little delay.

Related

Gif in launch screen

Im using this Class for gifs:
https://github.com/swiftgif/SwiftGif/blob/master/SwiftGifCommon/UIImage%2BGif.swift
But now, i want to add a gif to the launchscreen and since i can't set custom classes here, i don't know, how to do that. Any Ideas?
You can not use Custom classes in Launchscreen. Create a UIViewController and mark it as an entry point. Play the gif there and after a certain time you perform a segue to other ViewController. This little trick will work
UPDATED
In order to implement the logo animation we’ll need to do two things:
Add the first frame of the GIF as a static image in the launch screen
When the app launches add a view in the root view controller that
loads the animated GIF at the same spot that we’ve put the static
image in the launch screen
This way, when the app launches the user will get the impression that the launch screen is animating.
Have a look at Animated launch screen using a GIF in iOS

launch screen customising

I'm new to swift and Xcode, and I'd like to know is there anyone willing to explain to me how exactly should I make my launch screen to show for 3 seconds and in that time slightly fades out?
I want to do a web view of a web page that I built previously, but want it to do the launch screen with fading before.
I've read all other questions related to the topic, but I don't understand them. Also have been following some tutorials on the subject, but nothing.
Anyone, please?
You can't do anything on your launch screen.But try this out and see if it's okay. Let's say you want to give a fade-in animation for an image in the launch. Let's assume that your launchscreen background color is blue. Make another viewcontroller and make this the first viewcontroller right after the launch screen. Make the background color of this view blue and add the image to that view. You can animate the image with UIView.animate method with a delay of 3 seconds or something. Doing this will make it look like an animation in the launch screen.
You can't do this in the launch screen.
That is not what the launch screen is for.
If you want to do this you will have to create a secondary "launch" screen that your app loads first and then load the web view and when it's loaded push another view onto the screen,

Swift programatic splash screen

Is it possible to make the splashscreen/LaunchScreen programatically? And if so how?
I currently have a launchscreen.xib file. But I'd like to convert this into a .swift file with code instead.
However I havn't been able to find anything on how to do a launchscreen purely programatically.
The whole point of a launch screen is that it's shown before your code is ready to run. So that it can load quickly, it can only be an image or a xib.
You can certainly swap in a programmatic screen which looks the same after the launch screen shows, but you can't put code in that initial screen.

Transparent splash screen on the first (and only first) startup of an app for instructions (iOS) [duplicate]

This question already has answers here:
How to detect first time app launch on an iPhone
(17 answers)
Closed 9 years ago.
I have a simple app where the buttons are in the form of logos rather than text. Things like undo, reset, settings, etc... I'm trying to keep the interface simple, so I just want to have instructions shown on the first ever startup of the app. I've seen this done in other apps, where a transparent subview with labels is loaded, then touching the window dismisses the subview.
I currently have the launch count stored in NSUserDefaults, so I just need to figure out how to add the subview on top of the main view, which then gets dismissed on a touch. I would like to just load a png that fits the screen size in the subview.
This seems simple, but I am having trouble not overcomplicating this process.
Thanks!
check for your NSUserDefaults for the first launc and if it is then you could display your image as a modalViewController and to dismiss it on touch use touchesBegan metod to dismiss this controller.
This seems simple, but I am having trouble not overcomplicating this process.
What have you tried?
There's not much required to add a view to another view, but you don't even have to go that far. You could add your instructions view in your .xib/storyboard file and set it's hidden property to YES. Then all you need to do if the user is launching for the first time (or if they ask to see the instructions again) is flip the hidden property to NO, and then back to YES when they touch it.

Rotations issues in ios6 - black screen

I found several problems with rotations in ios6 using iPAD...all of us...I resolved mostly all of them using the new method shouldAutorotate and shouldAutorotateToInterfaceOrientation. But in one of the views is not updating properly the rotation. You can see (more or less) what happen:
The top images describes the behaviour from landscape to portrait...if I change the rotation of my app in other different of the first image, and come back to the first tab, the app doesn't update properly the view in portrait.
The bottom images describes what happen when I am comming from portrait to landscape...in the last screen I can the half of the screen completely black.
My level in iOS is really basic I will like some tips...what do you think which could be the problem? because in other tabs is not happen of the same app it is not happen.
If you need a piece of code, let me know...thank you!
Try this:
https://github.com/alexth/TBSV
Sample how to have NavigationBar, TabBar and SplitViewController in one project with correct looking transitions between orienations
Thanks for your reaction (ironic). I've discovered what was the problem with the rotation only in a particular screen of my app. The problem is that the one that built the app before me, used one UISplitViewController inside of a UITabBarController. This mix of ViewController, in iOS 6 bring a bunch of problems, specially with the rotations. After thousands of tries, I found this link and it is solved.
UISplitViewController inside UITabBarController in iOS6:
http://objectiveseesharp.wordpress.com/
That's all.
Should I change the title of the question?

Resources