我有 xml 文件,我在 xml 文件中读取了所有信息并存储在数组中,
这是我用于存储在数组中的 starDidElement 文件:
-(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];
在我的标题中,我有
Presentation thePresentation;
你能帮我解决这个问题吗
提前致谢
编辑:
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];
那么日志是
[788:c07] 演示文稿是:(null),它的幻灯片计数是:0 [788:c07] 幻灯片标签是:(null)