TagXcode

How To Use Xcode’s Auto Layout To Center Elements In An iOS App

Centering elements in Interface Builder is very simple, because Xcode will snap items to the vertical or horizontal center of the canvas, the same way that other Apple apps help you center items in a document (Pages and Keynote are the first examples that came to my mind).

However, when it comes to iOS apps, just because an element looks centered in the canvas, doesn’t mean that it will be centered all the time on every device: if you switch to a device with a different screen size (even in the simulator), the elements won’t be centered anymore.

This is because, in Interface Builder, you place elements with fixed positioning by default. If you want your app to look the same on every screen size, you will have to use a technique called Auto Layout.

Continue reading

How To Add A Launch Screen To An iOS App

I have recently started to play around with Swift programming as I always wanted to code something for iOS, but always ended up either lacking the time to do it, or developing for Android, a platform with which I am more experienced since my university days.

One of the most confusing things for me, coming from Android development and its interfaces in plain XML, was getting used to Interface Builder in Xcode, finding the elements I need, ultimately, getting the storyboard files to do what I want them to do. Also, navigating the Xcode project settings is no easy task for a beginner, so I am still finding roadblocks every time I try to do the most simple tasks.

Continue reading

© 2018 Daniel's TechBlog

Theme by Anders NorénUp ↑

%d bloggers like this: