Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>So first you create a .h file like <code>@interface MyIcons : NSObject</code></p> <p>and you kick off your singleton implementation with:</p> <p><code>+(MyIcons *)sharedIcons ;</code></p> <p>followed by:</p> <pre><code> typedef enum { IconMenuSmallWht, IconMenuBigWht, IconShoppingSmall, IconShoppingBig, IconSleepingSmall, IconSleepingBig, } iconType; - (NSString*) iconToString:(iconType) chooseIcon; </code></pre> <p>in the .m file you finish up your singleton implementation first:</p> <pre><code> +(MyIcons *)sharedIcons { static dispatch_once_t once; static MyIcons *sharedIcons = nil; dispatch_once(&amp;once, ^{ sharedIcons = [[self alloc] init]; }); return sharedIcons; } </code></pre> <p>and you end with doing:</p> <pre><code> - (NSString*) iconToString:(iconType) chooseIcon { NSString *result = nil; switch(chooseIcon) { case IconMenuSmallWht: result = @"ag_icons_btn_menu_wht"; break; case IconMenuBigWht: result = @"c"; break; case IconShoppingSmall: result = @"ag_icons_idx_ico_shopping_wht"; break; case IconShoppingBig: result = @"ag_icons_idx_ico_shopping_wht_120"; break; case IconSleepingSmall: result = @"ag_icons_idx_ico_hotel_wht"; break; case IconSleepingBig: result = @"ag_icons_idx_ico_hotel_wht_120"; break; return result; } </code></pre> <p>Thats it. It just add icons to the enum and to this switch/case. and wherevever you want to implement your icons you just #import MyIcons.h</p> <p>add <code>[MyIcons SharedIcons]iconToString:</code> and voila you get your list of choosing.</p> <p>Hope you enjoy this way of doing it. I know I will! (-:-)</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload