I am new in development for iOS/OSX in xcode. I am doing app for iOS in xcode 6 GM. And how can I add new elements like(UIButton,UITextField) but I wanna that these elements are in same position for every resultion (iphone 4 to iphone 6 plus). How can I do it? It is possible or I must code for every resulution different possition?
Thank you for replies.
Look into auto layout. That will solve a lot of your issues.
If you are like me, and don't like using auto layout, you can download my file in the link, and create multiple storyboards and with the names of Main, iPhone5, iPhone6, iPhone6Plus, and in the AppDelegate.swift you would put the code in to call for those story boards for the respectful device.
https://www.dropbox.com/s/3o0qhxcqx0yekax/ScreenSizes.zip?dl=0
Related
I'm trying to make my first iOS app in xcode 7 for iOS 9
and i want to make it for all the iphone devices like iphone 4,4s,5,5s,6.
Do i have to make a different xib file for each one of the iphone or there is a simple way to make it for EVERY iOS device also like iPad???
There's a magical thing called autolayout. And another thing called universal app
You Can do both in single storyboard first you have to choose Universal while creating project. You need to do autoresize or apply auto layout.
No, you shouldn't need to do device or resolution detection. iOS includes lots of features for adaptive user interfaces. See here for example: https://developer.apple.com/design/adaptivity/
You just use auto layout concept in your application and you will find lots of document on net for auto layout and re sizing class.
You can make one app for all device using autolayout and make your app universal and in xcode 7 and ios 9 there is new feature available stack view using this you can do this.
I have created an app in Swift and I want it to be available in both iPhone and iPad, but I would like the iPad to have a couple different layout variables, such as bigger buttons and pictures. Using auto-layout or Size Classes with constraints wasn't working and not letting me put them where I want them, so I was wondering how to make it so that when I open the simulator with an iPad, it opens the storyboard with the different View Controller layouts. I made a duplicate storyboard so I have main.storyboard and the copy is mainiPad.storyboard for the iPad only. If this can be done, please let me know! Thanks!!
This Tutorial is the old way, when You simply add iPad suffix in the file name.
This Post is the new way, introduced in Xcode 6; You simply select the storyboard name for ipad and iphone family in application plist file.
I have a problem here. My simulator works except the fact that it does not display the layout the way I want to. For example let's say that I put 8 buttons in a row - same size - and then start the simulator. The simulator displays only 6 buttons,not the whole image. I scaled it to 50/100 but it did not fix my error. Any help? I am new to Xcode and I can't wait to start program apps for iOS..
Thank you!
You need to learn about Auto Layout and more specifically how to set constraints for different screen sizes. Before that, try running your project on different iOS Devices (simulator) to see the effect.
There is Ray's Video Tutorial on Auto Layout and the Beginning Auto Layout blog post for iOS 7. Maybe you give the rich Apple documentation a chance: Auto Layout Guide.
I have created an app with a storyboard in Xcode and I now want to create an iPad version. I successfully created an iPad storyboard, but it currently runs with the code from the iPhone version.
The issue I am having is that the code for the iPhone is still running with the iPad storyboard. I would like to duplicate the iPhone code and adjust it for the iPad.storyboard, but I am not sure how to do that. Thanks.
I took a screenshot for you:
So switch the tabs and assign the appropriate storyboard. and make sure it is set to universal.
If I understand your problem, you now have two storyboards, one for iPhone and one for iPad, which are both working properly, but you want to modify part of the code just for the iPad version.
You should duplicate the classes you want to edit for the iPad version of your app and assign those new classes to the corresponding ViewControllers of the iPad storyboard.
Of course, you are still making a single, universal app.
Okay- I have this space shooter app based on uiimageviews. Originally, I made it on Xcode 3. Then, I converted it to Xcode 4. However, I did not use story mode. I stuck with the .xib files and it worked fine after I edited some of the basic code around. Then, when Xcode 5 came out, I couldn't do that anymore. When I tested my app on the iPad, most of the screen was grey and only the top corner had my game in it. I would like it to be able to auto size using just the xib files. Also, with the 4 inch and 3.5 inch iPhones, how can i make a view that fits them all? I tried storyboard, but my app was based on .xib files. It is one view controller, but it loads a lot of different .xib 's. What is my solution?
The solution is to switch your app from universal to just iPhone.
You can find a solution to a problem, similar to the one you are having, in the following stackoverflow How to convert a project using XIBs to Storyboard?