Question

In the section of code below, what exactly does the <UIScrollViewDelegate> part mean and do? what would it most likely be used for and what would most likely happen if it was removed? (any theoretical example is good)

@interface PhoneContentController : ContentController <UIScrollViewDelegate>
Était-ce utile?

La solution

It means that PhoneContentController adopts the ObjC protocol named UIScrollViewDelegate.

A protocol is an interface of methods without definition. When the class adopts it, it advertises that it implements the methods declared by the protocol.

This is a common feature in OOD for an abstract type, particularly in languages which use single inheritance only. If you know Java, it's much like implements UIScrollViewDelegate.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top