Use this approach to reuse logic which is shared and independent of rendering. This type of reuse requires you to correctly factor code so that the view is not connected with the controller. The controller manages any non-view related actions and passing any necessary information along to its view. UIViewControllers provides a view for convenience, but when you reuse a controller, you should create a custom view which you can factor to better support different devices. The CRS-IUA ATGHomeViewController has been refactored to demonstrate this type of code reuse. The ATGHomeView, which is the view managed by the ATGHomeViewController, has extensions for defining logic for a specific device.

For example, you could write a very simple extension ATGHomeView_iPad that only needs to override one or two methods to support display on iPad. While this type of reuse does not utilize all of the same code, it typically can achieve a high percent of code reuse.


Copyright © 1997, 2013 Oracle and/or its affiliates. All rights reserved. Legal Notices