Launch screen on xcode 6 - ios 8 - iphone

I am building my own app (but I'm a beginner) and I want to know if there are tutorials about "launch screens" in Xcode6.
I also want to know if it is possible to test the internet connexion before displaying the storyboard.
Thanks for your answers ! :)

I think this will help:
http://oleb.net/blog/2014/08/replacing-launch-images-with-storyboards/
Also, I would recommend not making the display of your storyboard wait until after you test the internet connection, as this could make the launch of your app slow.
If you are using a Storyboard by declaring it in your plist file as is typically done, then this is the order in which events occur:
It instantiates the app delegate based on the class name you passed into the UIApplicationMain function.
It creates a new window attached to the main screen.
If your app delegate implements a window property, iOS sets this property to the new window.
It loads the main storyboard referenced in the app’s information property list file.
It instantiates the main storyboard’s initial view controller.
It sets the window’s rootViewController property to the new view controller.
It calls the app delegate’s application:didFinishLaunchingWithOptions: method. Your app delegate is expected to configure the initial view controller (and its children, if it is a container view controller).
It calls the window’s makeKeyAndVisible method to display the window.
Source: https://developer.apple.com/library/ios/featuredarticles/viewcontrollerpgforiphoneos/ManagingDataFlowBetweenViewControllers/ManagingDataFlowBetweenViewControllers.html#//apple_ref/doc/uid/TP40007457-CH8-SW1
Therefore the storyboard and initial view controller will have already been instantiated by the time application:didFinishLaunchWithOptions:. If you really needed to do the connection test before the storyboard was loaded then you could not declare the storyboard in your plist and you could load the Storyboard programatically in your application:didFinishLaunchWithOptions: method after you have done your test. I would not recommend this however.

I am adding here the steps in short for creating the LaunchScreen through xib instead of using storyboard for iOS 8. This could be useful for persons like me, searching for how to create Launch Screen in iOS 8.
1) create a new "LaunchScreen xib" from new file --> user interface --> launch screen ( keep auto layout ON ).
2) Add an image view in the xib --> view (main view).
3) set splash image to it ( the image should not be in assets file ).
4) set image as "Aspect Fit" ( if required ).
5) you may also change the "view" (super view) background color as close to background color of image.
6) select the image view, click from menu - editor - pin - bottom space to super view.
7) this will show red error mark near "view" ( super view of image view ).
8) click on the error mark, you will see approximate two auto layout errors.
9) on clicking on the error you will find menu with auto fix the layout errors.
10) on fixing the errors, you will find total four "Constraints" with "vertical" and "horizontal" space between superview and image.
11) now you may test them in different devices or simulators.
Regards.

Related

How do I get a crossfade transition with resize on macos using storyboard & NSTabViewController?

On a brand new MACOS application project (swift, storyboards), using the latest available version of xCode (8.3) I can't get a crossfade transition with a NSTabViewController that I add to my story board. The window is not resizing as well.
What am I doing wrong ?
I start by adding a new window controller, I remove its content view controller that I replace by a tabviewcontroller.
The tabview controller comes with two tabs wired to two view controllers. I resize one of them to make it bigger and put random buttons on both of them to be able to check wether the full view is visible or not at runtime.
Everything is left with default settings, as well as the "crossfade" transition of the tabviewcontroller.
But when running the application, tabs change abruptly, and the window doesn't resize to display the new tab.
My goal is to build a preference panel on my storyboard ans I just fail on the first steps.
For crossfade animation to work, you need to connect delegate outlet of the tab view to the tab view controller.
It does not seem smooth resize is supported by the standard tab view, though.

Display items inside ScrollView on Storyboard

My problem is when i want to display multiple items inside a scrollview on Storyboard, i can't scroll to add more items because of the screen size of the View Controller. How can i get around this ?
Xcode version : 4.6
Autolayout : enabled
Here is what i want to do :
EDIT : I found a workaround to this problem. Just add items with minimal height and then resize it in code.
Try to beloved steps
after add button resize of view(height=568) and Viewcontroller > Simulated Metrics > Size > inferred
There is a way. Might seem difficult but its actually quite easy. It's a hybrid solution, with storyboard and nib file. You have to build a view inside a nib file instead of a storyboard.
1) Create your view controller named, let's say, "MyViewController".
2) Create a nib file, named "MyViewController" (name of a viewcontroller and nib file must match for this trick to work).
3) Go to that nib file, you created, drag a scroll view from object library.
4) Look at the side menu, and search for "File's Owner" icon (empty
cube), Under identity inspector Change the file's owner to the view
controller you created, "MyViewController".
5) Right click on the file owner and a menu will pop up, control drag, from the view connection to the scroll view you dragged from object library.
6) Click on the scroll view you just dragged, and go to the attributes inspector.
Under "Simulated Metrics" change "Size" from "Retina 4 Full Screen",
or whatever it happens to be, to "Freedom".Now you can drag bottom
edge of the scroll view down, to make enough room for all the
subviews. Make sure you don't accidentally increase the width.
7) Go back to the storyboard.
8) If the view controller is not created, drag it from the objects library.
Change its class to "MyViewController".
9) Now this is where the trick is gonna happen.
Make sure you delete ALL views from that view controller, including
the background view. If you do that correctly you will be able to see
the grid background of the interface builder. This forces the
storyboard to look for a nib named the same as the view controller.
10) Run, and smile (Make sure that you add some subviews to the scroll
view, that are off the bounds of a single screen, so you must scroll
to see them, otherwise it wont set the contentSize correctly, and you
wont be able to scroll ) :)
make scrollview object and set in viewDidLoad .
self.scrollView.contentSize = CGSizeMake(320, 960);
Use what height you want like: 960
I don't think it is a very practical way to do it in IB. A better approach would be to do it in code.

Adding and controlling view controllers in storyboard in xcode

I am new to iphone programming and I have created a special scenario. I am pretty sure that it will answer most of my questions for creating my app. Here it is. (i HAVE Xcode 4.2)
I have created a universal application with storyboard and single view.
I have appDelegate, storyboard files and a class file ViewController.h/m for my initial ViewController.
Suppose I have added a progress View (Graphically) on the view Controller. Also I have added another viewController on storyboard and made its background black.
When i run the app my first viewController with progress view shows up
Now my questions are
1- How can I link my progress view in the class file and how can i set it progress for 5 seconds.
2- After showing progress within 5 seconds it should switch to other view Controller with black background.
3- I have created a class file "MySecondController" How can i link this class to my black screen viewController.
These are easy questions. I hope I get answer to these. If anyone have tutorials linking to these questions do post. I have tried and haven't found useful.
Best Regards
1a) On the upper right of the xcode window, there's a tuxedo icon. This is the assistant editor. Select the storyboard, select the ViewController, then select the assistant editor. A second editor will appear. Make sure it's editing ViewController.h. Press control and drag from the progress view in the storyboard to a point inside the ViewController interface definition. (right after the line that looks like this: #interface ViewController : UIViewController) You'll be prompted to type an outlet name. Type something like "progressView" (no quotes).
1b) See below to set the progress view to a value.
2) See below to present the second view controller after a delay.
3) In the storyboard, drag a new viewcontroller onto the canvas. On the identity inspector (try the icons under the tuxedo icon, the third from the left is identity), set it's class to MySecondController. Select the original ViewController, press control and drag from it's status bar (the top of it) to the viewcontroller you just added. This will create a segue. A menu will appear asking what kind of segue you want. Make the segue modal for now. Click on the new segue to select it, then click on the attributes inspector (right next to identity inspector) give the segue an identifier, call it "MySecondControllerSegue".
Back to questions 1b and 2) Go to ViewController.m and add this code...
#synthesize progressView;
// this creates methods on self to access the progress view
// this is called after the view appears
- (void)viewDidAppear:(BOOL)animated {
// do inherited behavior
[super viewDidAppear:animated];
// set the progress view value to a number between 0.0-1.0, representing percentage
// notice how we used the synthesized getter: self.progressView
self.progressView.progress = 0.5;
// call another method with no parameters after five seconds
[self performSelector:#selector(doSegue) withObject:nil afterDelay:5.0];
}
- (void)doSegue {
// run the segue that you created in IB
[self performSegueWithIdentifier:#"MySecondControllerSegue" sender:self];
}
Build and run.
After this is working, you'll probably want to show that progress view advancing from the 0.0 position to 1.0 over the course of five seconds. For that, you'll need to read about NSTimer. You can set one up to send you a message periodically, and you can adjust the progressView each time.

View-Based Application? - Please explain

XCode: "This template provides a starting point for an application that uses a single view. It provides a view controller to manage the view, and a nib file that contains the view."
What does that even mean? (ie what does Single view actually mean)
1) This means that your application will only have a single view screen that is active
2) This means that your application will be able to have as many screens as you like using a single view controller.
Ok now what if your application has multiple screens? not a single view screen, is still suitable under a view based application template?
Example
Screen1(main): on this screen you have 3 buttons, "Open Form1", "Open Form2", "Open Form3"
When the button is clicked it opens up the associated screen,
Press the "Open Form1" button opens up "Form1" screen2
Press the "Open Form2" button opens up "Form2" screen3
Press the "Open Form3" button opens up "Form3" screen4
When the user completes the form and submits it, a thank you screen is displayed
therefore in this example there would be a total of 5 screens.
Each form screen contains is different, textfield inputs, and information, is this considered as a view based application?
View-based app is just a template to say that your app will be view-based. That means that you can have any number of views you want, as this template comes with a view controller (that, as the name says, can be used to control the views... show/hide them with animation, for example).
The template starts with ONE VIEW that is added to the app view controller. You can add any number of views to that controller.
So, yes to your questions. You can use this to create the app you mention, where any of the "screens" you mention would be a view, for example and you can show each one using, for instance, the app view controller to animate each view showing or hiding.
That means the template will create one view and corresponding view controller along with app delegate, main window. That will also do the necessary things to add this view to main windows, and load when app runs. This is just a template. Then you can crate any number of views and view controllers as you want.
This means that the template you are starting the project with provides a single ViewController, and associated XIB for the View. As the first answer says you could use this template to build the application mentioned.
HOWEVER you may wish to think about how the user is going to interact with your app. Will you allow stepping back and forwards through the screens, in which case you may want to consider the Navigation Based app where you push/pop screens onto a stack to allow easy movement between then.
You might also have a concept of allowing the user to jump at will between each of the screen pages in which case you might want to implement a TabBar application.
Or you could just implement it all yourself. At the end of the day it will be your application design, and the template is only a starting point to get you going. I would suggest that if you are starting out with iOS development however to go with 1 ViewController matched a XIB for each screen you wish to implement to keep things simple.

How do you set autosizing to flex in Interface Builder?

I have an iPhone project that I started as a Windows-based app and another View-based app. The Window app has a view which I added and I want to make the view fit within the window. In the View app the view is set to stretch.
Here is what it looks like when it is off.
(source: smallsharptools.com)
And here is when it is on.
http://www.smallsharptools.com/downloads/Stackoverflow/autosizing-on.png
I want to click in the middle of the Autosizing box but it does not do anything. What do I have to do in Interface Builder to make the View in a NIB to flex/stretch the view?
Usually when a view is locked down like that, it means that you have some simulated UI elements in place (like a fake nav bar, tab bar, or status bar). Select the top level view and go to the first tab of the inspector to see if any of those are turned on (you'd also see them on the view of course).
When they are all gone then you can change any of the resizing handles you like.
The view that is provided by default has this kind of limitation but you can overcome this by adding another view (you should delete the first view) to your xib and making this view the view of your file's owner. Besides this you would also have to change the height of this new view to 480 pxls.
Hope this helps.
Thanks,
Madhup