Building Toolbars
It’s easy to define and lay out toolbars in code if you’ve supplied yourself with a few handy macro definitions. The following macros return proper bar button items for the four available styles of items, and you can easily adapt them if you need more control options in your code. These macros are intended for automatic reference counting (ARC) use. If you use manual retain-release (MRR) development, make sure to adapt them with appropriate autorelease calls:
#define BARBUTTON(TITLE, SELECTOR) [[UIBarButtonItem alloc] \ initWithTitle:TITLE style:UIBarButtonItemStylePlain\ target:self action:SELECTOR] #define IMGBARBUTTON(IMAGE, SELECTOR) [[UIBarButtonItem alloc] \ initWithImage:IMAGE ...
Get The Core iOS Developer’s Cookbook, Fifth Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.