iphone - iCarousel's index -


how determine index of carousel?. or array's index loaded in it?. have loaded image nsdocumentdirectory.

self.myimages = [nsmutablearray new];   for(int = 1; <= 30; i++)  {      nsarray *paths = nssearchpathfordirectoriesindomains(nsdocumentdirectory, nsuserdomainmask, yes);     nsstring *documentsdir = [paths objectatindex:0];      nsstring *savedimagepath = [documentsdir stringbyappendingpathcomponent:[nsstring stringwithformat:@"myimages%d.png", i]];         if([[nsfilemanager defaultmanager] fileexistsatpath:savedimagepath]){              [images addobject:[uiimage imagewithcontentsoffile:savedimagepath]];              nslog(@"file exists");         }   }  

and added them in icarousel view:

- (uiview *)carousel:(icarousel *)_carousel viewforitematindex:(nsuinteger)index reusingview:(uiview *)view {     view = [[uiimageview alloc] initwithimage:[myimages objectatindex:index]];     return view; } 

if don't misunderstand question, can try use tag property of uiview comparison. example:

in viewforitematindex:

- (uiview *)carousel:(icarousel *)_carousel viewforitematindex:(nsuinteger)index  reusingview:(uiview *)view {     view = [[uiimageview alloc] initwithimage:[myimages objectatindex:index]];     view.tag = index;     return view; } 

compare currentitemview image

if (int == [(uiimageview*)[self.carousel currentitemview] tag]) {      //do } 

Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -