나는 XML 파일을 내가 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] 프리젠 테이션은, (널)과 슬라이드 카운트가요 : 0 [788 : C07] 슬라이드 레이블입니다 : (null)
을 당신은 본질적으로 같은 방법으로 그것을 당신은 자바에서 할 것 . –
@HotLicks는 응답 부분에 코드를 쓸 수 있습니까? – AntonMac