Need help on for loops inside initwithobject.


hi guys,

possible have loops inside initwithobject ?


code:
  self.photosource = [[mockphotosource alloc]  		initwithtype:mockphotosourcenormal                  title:@"flickr photos"  	        photos:[[nsarray alloc] initwithobjects:                     [[[mockphoto alloc]                     initwithurl:@"url"                     size:cgsizemake(407, 500)] autorelease],  
i want replace mockphoto multiple values using loops.

code:
  self.photosource = [[mockphotosource alloc]  		initwithtype:mockphotosourcenormal                  title:@"flickr photos"  	        photos:[[nsarray alloc] initwithobjects:                                        (int y = 0; y < 20; y++) {                                          [[[mockphoto alloc]                     initwithurl:@"url"                     size:cgsizemake(407, 500)] autorelease],                                             }  
any suggestion guys ?

 

no, objective-c not support lambdas. create nsmutablearray loop , pass variable nsarray parameter.
 


Forums iPhone, iPad, and iPod Touch iOS Programming


  • iPhone
  • Mac OS & System Software
  • iPad
  • Apple Watch
  • Notebooks
  • iTunes
  • Apple ID
  • iCloud
  • Desktop Computers
  • Apple Music
  • Professional Applications
  • iPod
  • iWork
  • Apple TV
  • iLife
  • Wireless

Comments