ios - Error When using Multiple Carousel -
i using multiple icarousels , want import pictures directory. have icarousel 1 on top , have icarousel 2 on bottom. have 6 folders in directory in ios device user has taken pictures. want assign icarousel 1 directory "apple" , icarousel 2 directory "green".
the below code until now. of course, gets error saying "redefinition of..." since setting paths 2 imagearrays. how should make code simpler?
furthermore, have warning saying 'nsmutablearray *_strong' 'nsarray *_strong'
@ imagearray2 = directorycontent;
line. want make working.
- (void)viewdidload { [super viewdidload]; //configure carousel imagearray1 = (nsmutablearray *)[[nsfilemanagerdefaultmanager] directorycontentsatpath: fpath]; nsstring *location=@"apple"; nsstring *fpath = [documentsdirectory stringbyappendingpathcomponent:location]; nsarray *directorycontent = [[nsfilemanager defaultmanager] directorycontentsatpath: fpath]; imagearray1 = directorycontent; imagearray2 = [[nsmutablearray alloc] init]; nsarray *paths = nssearchpathfordirectoriesindomains(nsdocumentdirectory, nsuserdomainmask, yes); nsstring *documentsdirectory = [paths objectatindex:0]; nsstring *location=@"green"; nsstring *fpath = [documentsdirectory stringbyappendingpathcomponent:location]; nsarray * directorycontent = [[nsfilemanager defaultmanager] directorycontentsatpath: fpath]; imagearray2 = directorycontent; carousel1.type = icarouseltypelinear; carousel2.type = icarouseltypelinear; }
you're declaring variables twice.
you can this:
-(void)viewdidload { [super viewdidload]; //configure carousel imagearray1 = (nsmutablearray *)[[nsfilemanager defaultmanager] directorycontentsatpath: fpath]; nsstring *location=@"apple"; nsstring *fpath = [documentsdirectory stringbyappendingpathcomponent:location]; nsarray *directorycontent = [[nsfilemanager defaultmanager] directorycontentsatpath: fpath]; imagearray1 = [directorycontent mutablecopy]; imagearray2 = [[nsmutablearray alloc] init]; nsarray *paths = nssearchpathfordirectoriesindomains(nsdocumentdirectory, nsuserdomainmask, yes); nsstring *documentsdirectory = [paths objectatindex:0]; location=@"green"; fpath = [documentsdirectory stringbyappendingpathcomponent:location]; directorycontent = [[nsfilemanager defaultmanager] directorycontentsatpath: fpath]; imagearray2 = [directorycontent mutablecopy]; carousel1.type = icarouseltypelinear; carousel2.type = icarouseltypelinear; }
Comments
Post a Comment