RSS フィード アプリを作成しています。フィードを webView でフォーマットし、説明のみを表示する必要があります。
コードは次のとおりです。
- (void)viewDidLoad {
[super viewDidLoad];
NSURL *myURL = [NSURL URLWithString: [self.url stringByAddingPercentEscapesUsingEncoding:
NSUTF8StringEncoding]];
NSURLRequest *request = [NSURLRequest requestWithURL:myURL];
[self.webView loadRequest:request];
}
指定された URL のすべてのコンテンツを読み込む代わりに、RSS フィードの「説明」のみをフォーマットして表示する必要があります。データを解析したので、Web ビューでフォーマットするだけです。解析用のコード (prepareForSegue):
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
if ([[segue identifier] isEqualToString:@"showDetail"]) {
NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow];
NSString *string = [feeds[indexPath.row] objectForKey: @"link"];
NSLog(@"Description : %@" , string);
[[segue destinationViewController] setUrl:string];
}
}