How to use a variable in another variable name

Discussion in 'iOS Programming' started by sam006, Sep 9, 2010.

  1. sam006 macrumors newbie

    Sep 8, 2010
    I am a new to dev iphone
    I want to ask that
    I have some variable like , a01 , a02 , a03 ,a04 each one hold a url of a jpg,which use for show image in UIWebview

    I want to make a button to change to display next photo, but I tried that @"a0%d",count is not work, could anyone can teach me how can I change to use another to call another url when user press the button

  2. PhoneyDeveloper macrumors 68040


    Sep 2, 2008
    Simplest way is to use an NSArray. Create the array with all the jpeg names in it. Set up an index that points to the current value in the array. Each time you access the value increase the index.

    It's also possible to use KVC for this but that's a little more of an advanced topic.
  3. sam006 thread starter macrumors newbie

    Sep 8, 2010

    I got it ~thanks !!

Share This Page