i just copy and paste all the view from iPhone storyboard and paste it on iPad storyboard,everything works fine but the base view from every view controller was locked and couldn't resize.any idea on this?
the property to adjust width,height,x,y was turn to grey and unclick-able.
you need to go to your project file in xcode -> summary tab -> ipad deployment info -> main storyboard. set that to your storyboard file. it should cause all your viewcontrollers to resize to the ipad size.
Related
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.
I am developing an app for iOS in which i took new ViewController
In that ViewController i dragged two UIButtons
Here is the image of .xib file
:
but when i run this project in my simulator i am unable to see my bottom button, you can see here in my simulator,
:
Where i am doing mistake ? i am not using autolayout because my deployment target is iOS 4.3
Thanks in advance.
if we create the navigationbar and tabbar programmatically then occupies a space in our viewcontroller so if we need to set our viewcontroller from .xib properly then we must have to left the space of navigation and tabbar by selectin those from .xib so that we can have exact space left for our other stuff i'm glad that it helped you. you're welcome. :)
It seems that your trouble caused by tab bar, that you create from code. I assume, you will see your button in case of simple comment line with tab bar creation. As this button is hidden, you can change it's y position or change size of your view in xib file.
I have observed such problems when we are using different sizes of .xib and iPhone simulator
i mean to say if u are using Ratina 4 for .xib .. make sure that u r also using iPhone simulator of Ratina 4 and the frame of TabBar Controller should b (0,0,320,568)
And in the case of Ratina 3.5 it should be (0,0,320,480)
I recently copied everything in my iPhone storyboard over to an iPad storyboard and changed nothing. It runs perfectly on the iPhone, loading WelcomeViewController as the initial scene.
However, when I run it on the iPad, the program crashes because it tries to load MainViewController as the initial scene.
I checked on Interface Builder, and the initial scene is set to view controller WelcomeViewController. I went in the debugger and put a breakpoint in the ViewDidLoad method of WelcomeViewController, and the iPad never hits that breakpoint but the iPhone does.
This is the Identity Inspector for the view controller of my initial scene.
This is the Attributes Inspector for the view controller of my initial scene (same as above).
Why does the iPad insist on trying to load ViewController as the initial view controller?
Thanks
EDIT: When I go to Targets > iPad Deployment Info, and set the main storyboard to the MainStoryboard_iPhone instead of MainStoryboard_iPad everything works. For some reason this MainStoryboard_iPad, a literal clone of the iPhone storyboard, doesn't.
Make sure your iPad view has initial controller set to WelcomeViewController in the storyboard. It is represented by an arrow as given below.
Next make sure your iPad Deployment section in target refers to your iPad storyboard.
I've designed my iPhone app in Photoshop and now I have all the PNG files of my project.
I have Xcode 4.2 and iOS 5. What I would like to do is to customize the tab bar of my app. I've done the things on storyboard, but I do not know how to implement the PNG tab bar in the storyboard. I've written the source code of the customized tab bar, but when I run it in the simulator it doesn't display the ViewController which IS already done on the StoryBord.
So, the question is: how to attach the new tab bar design with Xcode Storyboard?
If you've subclassed the UITabBar and written code to customize it, you'll need to set the tab bar's class to your subclass in the identity inspector. Click the tab bar in your storyboard and set it's class:
Then it should begin using your custom code.
I start my app in landscape for iPad. A nav controller holds my tableVC I click on a cell we push a new VC onto the stack. That works fine. The problem is, when I press the standard "back" button on the nav controller, my app gets forced into portrait and my tableVC is off of the screen. I am doing no manual positioning of views. This doesn't happen if I start the app in portrait mode.
How do I fix this abnormal behavior?
Notes: There is also a tab bar present in the app if it matters.
Upon further testing, if I load the NavController in portrait (with the first view being the table view) then switch it to landscape, then select the cell, then press back, it works fine. So the problem only happens if i start the app in landscape and never turn it to portrait.
EVERY VC has shouldAutoRotate set to return YES. I have subclassed the tab bar and done the same. I am wondering if this is a bug. Perhaps the problem lies in the fact that I took existing .XIB files and their views that were created for iPhone, then copied and pasted them, then deleted the iPhone specific views and then added iPad views.
If your subclassed TabBar Controller returns yes, and ALL of your VCs return yes for shouldAutoRotate, then the problem lies within your xib files. Though your explanation makes it sound like the VC you are pushing doesn't return yes, you've stated that it does, so it must be the xib files.
In IB, try setting the default orientation of your xib views to landscape, clean - build and run.
That may provide a clue or two.
Maybe you can create a new and simple iPad application with just a tabbarcontroller a navigation controller and 2 viewcontrollers to test if the cause is or is not the recycled iPhone .XIB files.
Also you can Command+Shift+F to search in the whole project for ": UIViewController" to double check that every VC has shouldAutoRotate set to return YES, in case you have third party code in your application that has a subclass of UIViewController on it. (the search will return a list of headers files that inherits from UIViewController).
I had had similar problems with really weird behaviors that were fixed by deleting the .XIB file and made it again.
Good luck finding the problem =)