Search code examples
ios5

ios system Share and settings buttons


I have a task to clone an application of... I can't change the client mind, pls do not suggest it.

I can't found where is hidden in iOS this 2 buttons. I think it is coming from iOS, not just a The buttons looks like: Share and Settings.

I am searching a code part, something like this:

refreshButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemRefresh target:self action:@selector(doStuff)];

but can't found a button share at:

typedef NS_ENUM(NSInteger, UIBarButtonSystemItem) {
    UIBarButtonSystemItemDone,
    UIBarButtonSystemItemCancel,
    UIBarButtonSystemItemEdit,  
    UIBarButtonSystemItemSave,  
    UIBarButtonSystemItemAdd,
    UIBarButtonSystemItemFlexibleSpace,
    UIBarButtonSystemItemFixedSpace,
    UIBarButtonSystemItemCompose,
    UIBarButtonSystemItemReply,
    UIBarButtonSystemItemAction,
    UIBarButtonSystemItemOrganize,
    UIBarButtonSystemItemBookmarks,
    UIBarButtonSystemItemSearch,
    UIBarButtonSystemItemRefresh,
    UIBarButtonSystemItemStop,
    UIBarButtonSystemItemCamera,
    UIBarButtonSystemItemTrash,
    UIBarButtonSystemItemPlay,
    UIBarButtonSystemItemPause,
    UIBarButtonSystemItemRewind,
    UIBarButtonSystemItemFastForward,
#if __IPHONE_3_0 <= __IPHONE_OS_VERSION_MAX_ALLOWED
    UIBarButtonSystemItemUndo,
    UIBarButtonSystemItemRedo,
#endif
#if __IPHONE_4_0 <= __IPHONE_OS_VERSION_MAX_ALLOWED
    UIBarButtonSystemItemPageCurl,
#endif
};

in

UIBarButtonItem.h

Any help would be appreciated where to look at. Need to support iOS 5.0

Edit: can't accept the answer with UIBarButtonSystemItemAction, because it looks like:

Action

As you can see, it is not the "clone" of original, bar far away, because it is missing the description ( text under icon), checked the UITabBarSystemItem, since those has text under icon, but nothing match the 2x images:

typedef NS_ENUM(NSInteger, UITabBarSystemItem) {
    UITabBarSystemItemMore,
    UITabBarSystemItemFavorites,
    UITabBarSystemItemFeatured,
    UITabBarSystemItemTopRated,
    UITabBarSystemItemRecents,
    UITabBarSystemItemContacts,
    UITabBarSystemItemHistory,
    UITabBarSystemItemBookmarks,
    UITabBarSystemItemSearch,
    UITabBarSystemItemDownloads,
    UITabBarSystemItemMostRecent,
    UITabBarSystemItemMostViewed,
};

It seems need to search a custom library and get those 2 icons for or make 2x custom buttons with those images.


Solution

  • UIBarButtonSystemItemAction is what you are looking for the Share.

    The settings icon doesn't exist as a system icon so you have to use a custom button with an image.

    Here is an example on how to create a Bar Button with a custom image

    EDIT:

    As long as the share button is not exactly the same with what you want, add two custom buttons if you want the icons to look exactly as the native ones.

    Kind reminder: Apple doesn't like it when developers immitating their custom controls when they aren't using the defaults.