I use nsxmlparser to parser data from server. I am trying to pass data to detail table view but I can't get the data into NSString.
This is my .xml
<?xml version="1.0" encoding="UTF-8"?>
< videos >
<Video id="1">
<name>Video 1</name>
<link>http://www.ebookfrenzy.com/ios_book/movie/movie.mov</link>
</Video>
<Video id="2">
<name>Video 2</name>
<link>http://www.ebookfrenzy.com/ios_book/movie/movie.mov</link>
</Video>
<Video id="3">
<name>Video 3</name>
<link>http://www.ebookfrenzy.com/ios_book/movie/movie.mov</link>
</Video>
<Video id="4">
<name>Video 4</name>
<link>http://www.ebookfrenzy.com/ios_book/movie/movie.mov</link>
</Video>
<Video id="5">
<name>Video 5</name>
<link>http://www.ebookfrenzy.com/ios_book/movie/movie.mov</link>
</Video>
<Video id="6">
<name>Video 6</name>
<link>http://www.ebookfrenzy.com/ios_boo开发者_运维知识库k/movie/movie.mov</link>
</Video>
</videos >
Links are the same, nevermind those. Problem is I cant get this link entry into NSString. Here is how I try to do:
NSString *videoString = [[videos objectAtIndex:indexPath.row] objectForKey:@"link"];
NSURL *fileURL = [NSURL URLWithString:videoString];
mp = [[MPMoviePlayerController alloc] initWithContentURL:fileURL];
[mp.view setFrame:CGRectMake(0, 70, 320, 270)];
[self.view addSubview:mp.view];
mp.fullscreen = YES;
[mp play];
If I try to use element in UILabel, I am able to show it in the label.
UILabel *label;
label.text = [[videos objectAtIndex:indexPath.row] objectForKey:@"name"];
Yet, when I try to retrieve it as NSString, I am unsuccesfull.
How can I use element as NSString ? Thanx in advance..
精彩评论