Вопрос

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>
Это было полезно?

Решение

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.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top