IOS CS193p - Why was the IBAction connection dragged to .m file and not to .h?

我是研究僧i 提交于 2019-12-05 09:10:39

Declaring things in a class's header file makes them part of the public interface. This includes outlets and actions defined on a view controller.

Whether something ought to be made public is a design question. A good principal is: only if it has to be. With ViewControllers outlets and actions, more often than not, they don't have to be - and therefore shouldn't be - public.

What usually happens is that you make some guesses up front about what the public interface should contain, then (if you're a tidy developer) you take a look again when the implementation is matured and remove anything inessential.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!