PDA

View Full Version : How to use a variable in another variable name




sam006
Sep 9, 2010, 09:08 PM
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


thanks



PhoneyDeveloper
Sep 9, 2010, 09:57 PM
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.

sam006
Sep 10, 2010, 03:05 AM
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.


I got it ~thanks !!