jeudi 21 février 2019

How was UIAlertViewController's initializer implemented?

This is a design question. I am creating a custom view controller programmatically, but when I try to customize the initializer for it, I must call designated initializer on its superclass.

Either:

init(nibName: String?, bundle: Bundle?)

or

init?(coder: NSCoder)

The problem is, one requires a decoder, which I don't intend to provide with my custom initializer, and another which requires a nibName and I don't intend to use a nib. I'm doing this programmatically.

How was UIAlertViewController implemented so that its initializer can function without taking a nib and an instance of NSCoder?

Aucun commentaire:

Enregistrer un commentaire