Search Results

Search found 1 results on 1 pages for 'moshikafya'.

Page 1/1 | 1 

  • modifying constants in objective c during run time

    - by moshikafya
    I am trying to solve the following problem. I have the following constants in my header file: #define PREFS_MY_CONSTANT_1 @"bla1" #define PREFS_MY_CONSTANT_2 @"bla2" #define PREFS_MY_CONSTANT_3 @"bla3" ... In one of my functions, I'd like to print to the UIbutton one of those strings based on user input, so say the user inputs '1', i would show bla1. Instead of creating a huge switch (i have 100 of those), I am looking for a way to combine the constant with the variable holding the user input, so something like that ideally: NSInteger input; [button setTitle:PREFS_MY_CONSTANT_{$input} forState: UIControlStateNormal]; Is something like that possible? what would be the best way to solve this?

    Read the article

1