Same xib for iPhone4 and iPhone5 possible? - xib

Is there any way I can design my classes for both iPhone4 and iPhone5 using the same xib?

Yes, you can use the same XIB to design for iPhone 4 and iPhone 5 by using Auto-Layout.
Build an app using iOS 6 as the Base SDK and use the Auto Layout feature to make screens that can scale for all type of screens. You'll need Xcode 4.5 to do this.
Get started with Auto Layout here:
http://www.raywenderlich.com/20881/beginning-auto-layout-part-1-of-2
http://www.raywenderlich.com/20897/beginning-auto-layout-part-2-of-2

Well short answer to you question is YES;
Long is :- If you user XCode 4.5 and build app that is universal the NIB files and Classes would work perfectly for Iphone 4 and Iphone 5; Understand for you it important to know the version of SDK of these mobiles not the mobile version them self.
Another thing is that iphone 5 size is little bigger then iphone 4 so you need to design accordingly.. please read my answer at Iphone 5 screen resolution issue for better understanding.
Also look at the How to develop or migrate apps for iPhone 5 screen resolution? answer for more clarification on universal app desing.

Add a image named Default-568h#2x.png. That will identify your app as one that supports iPhone 5 metrics. And also you need to do auto sizing of your views properly.

yes it is possible,
just remove the side angle and make object free by enabling inner arrow.
so it will automatically resize according to screen.
but remember one thing that this will only work when you provide all default or any other splash screen.

If you want to make some small changes(e.g images position and sizes, scroll view content insets..), you can use codes to differentiate between iPhone 5 and iPhone 4/4s, and implement your codes inside the if/else statement.
Use this:
https://stackoverflow.com/a/12447113/1371949
to detect the iPhone type.

You can use auto layout feature provided by apple. Please refer to apple document for this:-
https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/AutolayoutPG/Introduction/Introduction.html

Please define below line and check condition based on device.
#define IS_IPHONE_5 ( fabs( ( double )[ [ UIScreen mainScreen ] bounds ].size.height - ( double )568 ) < DBL_EPSILON )
if (IS_IPHONE_5) {
btnBookmark.frame=CGRectMake(0, 460, 100, 70);
btnBookmark.frame=CGRectMake(150, 460, 100, 70);
}else{
btnBookmark.frame=CGRectMake(0, 360, 100, 70);
btnBookmark.frame=CGRectMake(150, 360, 100, 70);
}

Use AutoAutoresizing so that u can make app compatible with both iOS 5 and iOS 6. This is easy if your layout is having minimum dependancies. And this is possible for fixing issues with components like UIToolBar. Buttons in iPhone 5.

Related

ios design in iphone SE but I want to make the design in iphone 8 plus

I have got the application design in iphone SE (sketch). But I am designing app in iphone 8 plus. I want the exact sizes and dims for iphone 8 plus. But when I change the simulator I sketch it only changes the screen sizes not all the elements.
Open your storyboard and try clicking as picture below :
Change the view to iPhone 8 Plus :
As i know, Sketch allow you to use constraits for controls. Please, see here for more information.
If we talk about development process - auto-layout can help you with problem.
More about auto-layout you can find here
In the bottom of the Storyboard you can find this button
Click on it and you can choose what device you set your layout for.
All you gotta do is this: Add missing constraints

AutoLayout for only iPad application

I would like to start my application that need to support for only iPad devices. Now, my question is do I need to use the Autolayout functionality?
What am thinking is as my app supports only iPad,no need to use the autolayout because all the ipad devices uses same size classes.
Correct me if am wrong.
You have to use size classes even if you are using only iPad device as target for your application. There are some reasons why you have to use the size classes :
1) iPad have diff screen sized and resolutions as well. check them Out here.
2) The iPad multitasking feature is there from ios 9 so you need to resize your views according to that and that will need size classes check it out here.
NOTE : if you are using autolayout then no need to use size classes but size classes are important you can check the importance of the size classes and its working in apple's design guide line (here)
ipad has different device size like 768 x 1024 and 1024 x 1366 (ipad pro) etc. so, you should use autolayout to manage it for every ipad device.

How I can use different objects in ViewController to be fullscreen in every iPhone and iPad?

I have a project on Objective C. It has many textfields,buttons,search buttons so it runs cool on iPhone 6, iPhone 6 plus, but on others some objects disappear. Also I make LaunchImage to every iPhone and iPad which I use, but it doesn't help. What can I do?
Every object position is relative to their parent.
So, you need to use autolayout to adjust your elements in different resolutions.
You can check Apple's guide about it:
https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/AutolayoutPG/Introduction/Introduction.html
Also this useful tutorial:
http://www.raywenderlich.com/50317/beginning-auto-layout-tutorial-in-ios-7-part-1

How to support one xib for all iPhone devices upto iPhone 6 Plus?

I started one new iOS apllication. And that application requirement is app should support from iPhone 4 to iPhone 6 Plus. I am very much familiar with using Xib files. So far I differentiated my apps with iPhone 5 and below iPhone 5. For that I Used 2 Xib files for one is for iPhone 5 and other is iPhone 5 below according to device height I added like that. But now apple has relased iPhone 6 and iPhone 6 Plus with iOS 8 along with XCode 6. For these 4 types devices,
1) iPhone 4 2) iPhone 5 3) iPhone 6 and 4) iPhone 6 Plus do I need to add 4 Xibs or any other solution.
To learn Storyboards, now I don't have that much time because my app has already release date confirmed from Client. But I will learn about sotryboard in future definately.
I have tried with Autolayout concept, but its not worked for me. and I dont have full awarness on Autolayout concept also. Yesterday I started my new project with XCode 6, So I taken iPhone 6 view and tried to use autoresizing and autolayout but not worked for me and views are overlapping. I know for different devices creating different xibs is not good practice. For creating each device with each xib would take huge time. I am really bothering about this how to handle different devices from yesterday onwards. Please somebody help me to came out from this issue. Really highly thankful to you. If anything mistakes in my content please forgive me.
Your question deserves a longer answer than StackOverflow can provide, but there are a few pointers I can give you.
For each of your xibs, enable Size Classes and Autolayout.
Set each xib root view's size class to width Any and height Any, which I believe are the defaults.
Design your interface in a way that looks decent on this theoretical Any x Any device.
I highly recommend using a UIScrollView at the top level of any view controller's view hierarchy.
Use constraints to anchor the controls. I find it easiest to start with the control in the top left corner, anchor it to the containing view's top and left sides, and then work your way down and across until all of your controls are constrained on all 4 sides, or on one vertical and one horizontal size, along with explicit height and width. Be generous with the greater-than and less-than relationships in your constraints.
To customize for each device layout, switch the size class to the desired combination. Note that any constraints you add, change, or remove, as well as any controls that you add or remove, will be changed only for the current class size. Do this for each different size class that you're going to support. See Apple's reference for which size classes are used for each device.
Test your layouts using the Resizable Device simulators.
This is hard work, but it sure beats having to maintain a different xib for each device size.

convert iphone 5 app to use 3.5inch screen

i am relatively new to this and i have just launched my first app, when i was filling in the information to launch the app on the dev account i realised that there was another screen size my app would need to fit, i have already completed the app and have made it a 4 inch screen size fitting the iPhone 5 and 5s, how can i make it compatible with the iPhone 4 and 4s? i have checked other questions but i don't really understand it if anyone can just give me a simple answer to this it will be greatly appreciated.
thank you
If you have more complicated UI then either use new .xib or Storyboard for 3.5 inch for all classes.
The solution is to use autoresizing masks or autolayot(constraints).
Attribute inspector for view controller have a list "Size". You can select 3.5" to watch out you app appear.

Resources