Note that there are some explanatory texts on larger screens.

plurals
  1. POGetting an array from another class objective-C
    text
    copied!<p>I have xml file and I raed all information in xml file and store in array,</p> <p>here is my starDidElement file for storing in array: </p> <pre><code>-(void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict{ if ([elementName isEqualToString:@"Presentation"]) { NSLog(@"user element found – create a new instance of User class..."); app.presentationArray = [[NSMutableArray alloc] init]; thePresentation = [[Presentation alloc] init]; thePresentation.pLabel = [attributeDict objectForKey:@"label"]; NSLog(@"PLabel: %@", thePresentation.pLabel); }else if ([elementName isEqualToString:@"slides"]) { NSLog(@"Slides"); thePresentation.slides = [NSMutableArray array]; </code></pre> <p>and in my header I have </p> <pre><code> Presentation thePresentation; </code></pre> <p>would you please help me to inpelement this</p> <p>Thanks In advance</p> <p><strong>Edit:</strong> </p> <pre><code>Presentation *aPresentation = [app.presentationArray objectAtIndex:0]; NSLog(@"Presentation is: %@ and it's Slide Count is: %d",aPresentation.pLabel, aPresentation.slides.count); Slide *aSlide = [aPresentation.slides objectAtIndex:0]; NSLog(@"Slide Label is: %@", aSlide.sLabel); UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom]; [btn setTitle:[NSString stringWithString:aSlide.sLabel] forState:UIControlStateNormal]; btn.frame = rect; [btn setTag:i]; [btn addTarget:self action:@selector(buttonClick:) forControlEvents:UIControlEventTouchUpInside]; [imageView addSubview:btn]; </code></pre> <p><strong>then The log is</strong> </p> <p>[788:c07] Presentation is: (null) and it's Slide Count is: 0 [788:c07] Slide Label is: (null)</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload