开发者

Why Are Almost All iOS SDK Delegate Methods Optional?

I understand the pros and cons of optional vs. required delegate methods. But I was struck by how few of the iOS delegate methods are required. Is there some wisdom that the iOS SDK designers have that I don't? Is there something they're trying to avoid that I don't see?

Thanks in adva开发者_开发知识库nce.


The simplest answer is that most programs won't use most delegate methods, so instead of making developers create empty methods that aren't used, the methods are designated as optional, and can be used only when you need them. The reason there are so many methods is because the SDK designers have provided a lot of things you can do, which is necessary for a robust device like a smartphone.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜