Avoid abuse of inheritance

Avoid abuse of inheritance

Inherited really useful, methods consequence is a subclass of the parent class will perform again brought one by one, at first glance nothing, but if this method is very consumption performance yet.

We ran into this project, app often stuck with the use, you freeze, the point where no response. Because all the pages are designed Chengzi Ji, following a class, just a base class which has a relatively time-consuming operation, each page will perform at least three times, it has led to a page of suspended animation.

Practice after reconstruction is designed as a category, just to add a UIViewController several methods, on-demand call, do not need to have to call on every page, so to solve this strange bug.

Published 49 original articles · won praise 7 · views 30000 +

Guess you like

Origin blog.csdn.net/qq_29680975/article/details/103238596