私は別のページにUILabel
あり、ファイルUIButton
からタイトルを読みたいのですが、値を取得しました。使用したときのクラスでは答えはありますが、設定したいときは、この実装で私を助けてくれませんか?xml
NULL
XML parser
NSLOG
NULL
前もって感謝します!
私のXMLパーサー:
- (Presentation1NameXML *) initXMLParser {
appDelegate = (testAppDelegate *)[[UIApplication sharedApplication] delegate];
return self;
}
- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName
namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qualifiedName
attributes:(NSDictionary *)attributeDict {
if ([elementName isEqualToString:@"Presentation1Name"]) {
appDelegate.books = [[NSMutableArray alloc] init];
NSLog(@"The Prices Count");
}
else if ([elementName isEqualToString:@"Presentation"]) {
presentation = [[Presentation alloc] init];
presentation.pLabel = [attributeDict objectForKey:@"label"];
NSLog(@"khengggg %@",presentation.pLabel);
// }else if ([elementName isEqualToString:@"Slides"]){
// slides = [[Slide alloc] init];
}
if([elementName isEqualToString:@"slide"]) {
slid = [[Slide alloc] init];
NSLog(@"Processing Element: %@", elementName);
slid.index = [[attributeDict objectForKey:@"index"] integerValue];
NSLog(@"Reading index value :%i", slid.index);
slid.sLabel = [attributeDict objectForKey:@"label"];
NSLog(@"Reading label value :%@", slid.sLabel);
slid.identifier = [attributeDict objectForKey:@"identifier"];
NSLog(@"Reading identifier value :%@", slid.identifier);
}
NSLog(@"Processing Element: %@", elementName);
}
- (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string {
if(!currentElementValue)
currentElementValue = [[NSMutableString alloc] initWithString:string];
else
[currentElementValue appendString:string];
NSLog(@"Processing Value: %@", currentElementValue);
}
- (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName
namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName {
if([elementName isEqualToString:@"Presentation1Name"]){
return;
}
if([elementName isEqualToString:@"Presentation"]) {
[appDelegate.books addObject:presentation];
presentation = nil;
}
// if ([elementName isEqualToString:@"Slides"]){
// [appDelegate.books addObject:slides];
// slides = nil;
// return;
// }
if ([elementName isEqualToString:@"slide"]){
[appDelegate.books addObject:slid];
slid = nil;
}else
[presentation setValue:currentElementValue forKey:@"pLabel"];
//[presentation setValue:currentElementValue forKey:elementName];
currentElementValue = nil;
}
私のレーベルコード:私は(null)を得ました
appDelegate = (testAppDelegate *)[[UIApplication sharedApplication] delegate];
label.textColor = [UIColor greenColor];
Presentation *p1 = [appDelegate.books objectAtIndex:0];
NSLog(@"aaaaaaaaa aaaa %@", p1);
label.text = p1.pLabel;
私のボタンコード:私は(null)を取得しました
UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
Slide *s1 = [appDelegate.books objectAtIndex:0];
NSLog(@" test %@", s1.sLabel);
マイオブジェクトクラスのプレゼンテーションリンク
マイオブジェクトクラススライドリンク