私は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)