我的XML文件,我RAED在xml文件,並存儲在陣列中的所有信息的數組,獲得從其它類目標-C
這裏是在陣列中存儲我的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;
請你幫我inpelement這個
感謝推進
編輯:
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]演示是:(空)和它的幻燈片Count是:0 [788:C07]幻燈片標籤是:(null)
你這樣做基本上是相同的方式,你會做它在Java中。 –
@HotLicks你可以寫你的代碼在答覆部分請 – AntonMac