objective c - how could i combine NSString with NSArray -


i have nsstring*url ,and want combine nsarray of number load picture ,i struggle many days still doesn't work know how it

p.s want replace nsstring %@ number of array

this nsstring *url = http://flicksbank.console360.net/images/%@/default.jpg

and number nsarray :

(

    42,     47,     56,     65,     97,     128,     277,     278,     312,     313,     518,     522,     523,     526 ),     (     42,     89,     522 ),     (     89,     312,     313 ),     (     89,     522 ),     (     91,     317 ),     (     98 ),     (     317,     518,     523,     525,     526 ),     (     329 ),     (     332 ) 

you can reach numbers 2 loops:

for(nsarray *numbers in yourmainarray) {      for(nsnumber *n in numbers)      {          nsstring *urlstring = [nsstring stringwithformat:@"http://flicksbank.console360.net/images/%d/default.jpg", [n intvalue]];      }  } 

or more general solution nsstring , nsnumber

    for(nsarray *numbers in yourmainarray)     {          for(id n in numbers)          {              if([n iskindofclass:[nsnumber class]])              {                  nsstring *urlstring = [nsstring stringwithformat:@"http://flicksbank.console360.net/images/%d/default.jpg", [n intvalue]];              }               if([n iskindofclass:[nsstring class]])              {                  nsstring *urlstring = [nsstring stringwithformat:@"http://flicksbank.console360.net/images/%@/default.jpg", n];              }          }      } 

Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -