Summary: How should the UIViewController
know the size of its UIView instance when initialising that view?
The dedicated initialisation method for an UIView
You don't have to use the designated initializer. Just use init as in [[UIView alloc] init]
. The designated initializer has to be used from subclasses' initializers.
On the other hand, setting the frame twice should not do much harm. Performing a lot of tasks in setFrame:
is unusual. Layouting is normally done in layoutSubviews
and is only performed once.