Category Archives: iOS8

The Presenter: going modal (popover or fullscreen) on iOS7 and iOS8

When we develop universal apps, we sometimes need to present  modal view controllers (“dialogs”) to the user.

On the iPad the popover is very useful to this aim because the user does not loose the context while reading the content of the dialog or while filling some inputs inside it.

On the other side, the iPhone usually has not enough space to show a popover inside the parent (or “presenting”) view controller (however this is possible now in iOS8). So on the iPhone we may want to present the new view controller in a modal full screen mode.

Continue reading The Presenter: going modal (popover or fullscreen) on iOS7 and iOS8

An iOS7 and iOS8 simple alert

In iOS8 the code to show a simple alert to the user is completely changed. UIAlertView is now deprecated:

alert deprecated

The new class is UIAlertController and it is not complex to use (more in a minute). But we also want to support our iOS7 users, so wouldn’t it be nice to have a single class handling the different code? This is what we are going to create in this post.

Continue reading An iOS7 and iOS8 simple alert

iOS8 Self Sizing UITableView Cells

The UITableView is a class we all have used at least once in our apps.

Sometimes we need a UITableView with cells all equal in height, but sometimes we need dynamic height cells, each one having a different height, typically dependent on its own content.

The old way

Before iOS8, this was not trivial since the system needed to know in advance the overall height of the table in order to set the content size of the scrolling area (UITableView inherits from UIScrollView).

Continue reading iOS8 Self Sizing UITableView Cells

iOS8 Layout Margins

iOS8 SDK introduces a new concept: the “layout margins”. A new property has been added to the UIView class:

These 4 values (the UIEdgeInsets fields) represent the margins of the view. Its subviews can now be positioned relative to these  margins.

For example, this is the result of an inside view whose leading space to the superview is 0 (relative to margin):

Schermata 2014-09-15 alle 13.09.59

Continue reading iOS8 Layout Margins

Transizioni adaptive e showViewController

it Nelle nostre app utilizziamo abitualmente l’UINavigationController, cioè un container che ci permette di mostrare tutte le nostre sotto-interfacce (UIViewController, o subclass di questa, di seguito VC) come se fossero idealmente disposte in uno stack tramite il quale possiamo navigare fra di esse avanti e indietro (push e pop).

Continue reading Transizioni adaptive e showViewController