Wednesday, October 19, 2011

Custom Appearance for UIKit Controls

Custom Appearance for UIKit Controls You can now customize the appearance of many UIKit views and controls to give your application a unique look and feel. For example, you might use these customizations to make the standard system controls match the branding for the rest of your application. UIKit supports the following customizations: You can set the tint color, background image, and title position properties (among other) on a wide variety of objects, including toolbars, navigation bars, search bars, buttons, sliders, and some other controls. You can set attributes of some objects directly, or you can set the default attributes to use for a class using an appearance proxy.An appearance proxy is an object you use to modify the default appearance of visual objects such as views and bar items. Classes that adopt the UIAppearance protocol support the use of an appearance proxy. To modify the default appearance of such a class, retrieve its proxy object using the appearance class method and call the returned object’s methods to set new default values. A proxy object implements those methods and properties from its proxied class that are tagged with the UI_APPEARANCE_SELECTOR macro. For example, you can use a proxy object to change the default tint color (through the progressTintColor or trackTintColor properties) of the UIProgressViewclass.If you want to set a different default appearance based on how a given object is used in your application, you can do so using the proxy object returned by the appearanceWhenContainedIn:method instead. For example, you use this proxy object to set specific default values for a button only when it is contained inside a navigation bar.Any changes you make with a proxy object are applied, at view layout time, to all instances of the class that exist or that are subsequently created. However, you can still override the proxy defaults later using the methods and properties of a given instance. Container View Controller Support The UIViewController class now allows you to define your own custom container view controllers and present content in new and interesting ways. Examples of existing container view controllers include UINavigationController, UITabBarController, andUISplitViewController. These view controllers mix custom content with content provided by one or more separate view controller objects to create a unique presentation for application content. Container view controllers act as a parent for their contained view controllers, forwarding important messages about rotations and other relevant events to their children. Settings Applications that deliver custom preferences can now use a new radio group element. This element is similar to the multivalue element for selecting one item from a list of choices. The difference is that the radio group element displays its choices inline with your preferences instead of on a separate page.

No comments:

Post a Comment

Followers