Animated UIActivityIndicatorView on LaunchScreen.xib - ios

With the new xcode one is able to present a .xib named LaunchScreen on launch, which is great. I added a UIActivityIndicator to this very file, but I am not able to animate it. How can I accomplish this? Do I need to add a code file just for this?
What I've tried
Selected 'Animating' in the 'behavior' section of the xib

Related

I have One storyboard with different/multiple UIViews and I want a ViewController for each UIView. Swift

I have one storyboard with different views, I do not want all the codes in ViewController.swift I would rather have a Swift for each UIView.
Is it possible? and how do I do?
Use UIContainerView instead of just UIView. When you drag a UIContainerView into your storyboard it'll automatically create a View. Just make a new Cocoa Touch Class file in your project. Make sure the file is put under UIViewController
Then click on the new View that was automatically generated, go to Properties, then select your new Swift file. This connects the View to the file.

custom viewcontroller from storyboard cannot be found in project structure

I created a new ViewController on main.storyboard, labels, buttons added manually, but I did not see this viewController in the project structure to customize it programatically and move it to the view folder.
Is it a bug, or I missed something? Thanks!
You should create a new file for every viewcontroller you add to the storyboard.

UIViewController defined in a xib file doesn't load in the storyboard

I'm trying to load a subclass of a UIViewController with its views defined in a xib file into a storyboard. Let's call it a NibViewController.
The point of this approach is to reuse the same ViewController in multiple screens of the app.
I know it's possible to do it manually in the code, but I'm looking for a solution in the storyboard. I've tried suggestions from other topics like this one, but nothing worked. The ViewController is correctly displayed in the simulator but not in the storyboard. Here is the code: https://github.com/srstanic/NibViewControllerInStoryboard
and here is the screenshot:
Am I mistaken to expect the contents of the NibViewController to appear in the storyboard?
Am I mistaken to expect the contents of the NibViewController to appear in the storyboard?
Yes, you are mistaken. Your app is working perfectly so you should stop worrying and just proceed.
By deleting the view from the view controller in the storyboard, you have specifically instructed the storyboard: "Do not make a view for this view controller. At runtime, the view should come from the xib file, not from you."
And that is exactly what does happen at runtime. So just design your interface in the xib file and all will be well.

Why Main.storyboard doesn't show?

I'm new to ios develop,I learned about storyboard recently and I'm trying to use it.But at last the storyboard file looks doesn't be loaded.
What I have done is:
1.add some ui elements like Button to initial xib file of storyboard
2.modify Main Interface in project - General page to Main.(my storyboard file name is Main.storyboard)
When I start the app,the screen is all white with nothing.Anyone can tell me why this happened and how can I solve this bug.Thanks!
Update1:As this image shows,I have set initial xib for storyboard.
Since you said you didn't created the project with a storyboard template, look for this line in your info.plist
This could happen because the subview frames are being created outside the view frame. Try setting some alignment constraints in your subviews.
You have to set your controller as initial view controller.
You can find it in your Main.Storyboard on the right site, if you select your first controller.
Here in 2021, a default Xcode project uses scenes, but that requires iOS 13 and I wanted to support iOS 12. I deleted the SceneDelegate file from my project and the scene delegate functions from the AppDelegate file, but then my storyboard wasn't loading either. The problem is that I also needed to remove the Application Scene Manifest section from info.plist.

How to remove xib file for UIViewController class?

I want to remove xib file for UIViewController classes. Please let me know, If any one know how to remove or delete xib file.
You can just delete the .xib file,
If you want a new .xib for your view controller, create new xib
Then give ViewController as File's Owner's Custom Class,
Finally, link the ViewCrontroller's view and .xib
I'd like to add that the labels and everything I had placed in the file still showed up in the Simulator after I had deleted my .xib
It seems, Simulator caches the contents and I had to delete the app from inside the Simulator to force it to totally rebuild. Worked after that.

Resources