Friday, May 31, 2013

UIBarButtonItem UIBarButtonSystemItemCompose example in Objective C (iOS).


UIBarButtonItem UIBarButtonSystemItemCompose


UIBarButtonSystemItem
Defines system-supplied images for bar button items.

typedef enum {
UIBarButtonSystemItemDone,
UIBarButtonSystemItemCancel,
UIBarButtonSystemItemEdit,
UIBarButtonSystemItemSave,
UIBarButtonSystemItemAdd,
UIBarButtonSystemItemFlexibleSpace,
UIBarButtonSystemItemFixedSpace,
UIBarButtonSystemItemCompose,
UIBarButtonSystemItemReply,
UIBarButtonSystemItemAction,
UIBarButtonSystemItemOrganize,
UIBarButtonSystemItemBookmarks,
UIBarButtonSystemItemSearch,
UIBarButtonSystemItemRefresh,
UIBarButtonSystemItemStop,
UIBarButtonSystemItemCamera,
UIBarButtonSystemItemTrash,
UIBarButtonSystemItemPlay,
UIBarButtonSystemItemPause,
UIBarButtonSystemItemRewind,
UIBarButtonSystemItemFastForward,
UIBarButtonSystemItemUndo, // iOS 3.0 and later
UIBarButtonSystemItemRedo, // iOS 3.0 and later
UIBarButtonSystemItemPageCurl, // iOS 4.0 and later
} UIBarButtonSystemItem;

UIBarButtonItem UIBarButtonSystemItemCompose example.
UIBarButtonItem *btn = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCompose target:self action:@selector(tweetPressed:)];
self.navigationItem.rightBarButtonItem = btn;
[btn release];

Example of [UIBarButtonItem UIBarButtonSystemItemCompose].
UIBarButtonItem *item = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCompose target:self action:@selector(self)];
item.style = UIBarButtonItemStyleBordered;
self.toolbar.items = [self.toolbar.items arrayByAddingObject:item];

UIBarButtonItem UIBarButtonSystemItemCompose example.
    UIBarButtonItem *infoButton = [[UIBarButtonItem alloc]
                                       initWithBarButtonSystemItem:UIBarButtonSystemItemCompose
                                       target:self action:@selector(support:)];

        UIBarButtonItem *next = [[UIBarButtonItem alloc]
                                       initWithBarButtonSystemItem:UIBarButtonSystemItemPlay
                                       target:self action:@selector(support:)];
        [self.navigationController.toolbar setItems:[NSArray arrayWithObjects:infoButton, next,nil] animated:YES];

End of UIBarButtonItem UIBarButtonSystemItemCompose example article.