例これは私のXMLです
<feed xmlns:im="http://itunes.apple.com/rss" xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
<entry>
<im:title>Como Una Virgen para Cristo</im:title>
<im:url>listindiario.com</im:url>
</entry>
すべてが完璧に機能します...
しかし問題は、ロード セル リンクの URL を押して UIWebView で別のビューを開くにはどうすればよいかということです。
ストーリーボードで作業しています
これはいくつかのコードです: AppTableViewController.m
#import "AppTableViewController.h"
#import "AppRecord.h"
#import <SDWebImage/UIImageView+WebCache.h>
#import "CustomCell.h"
#import "WebView.h"
#import "ParseOperation.h"
@class WebView;
@implementation AppTableViewController
#pragma mark - Table view creation (UITableViewDataSource)
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return [self.entries count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"LazyTableCell";
CustomCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
AppRecord *appRecord = (self.entries)[indexPath.row];
cell.nameText.text = appRecord.appName;
cell.detalleText.text = appRecord.artist;
cell.durationText.text= appRecord.appDuration;
cell.dateText.text= appRecord.appDate;
[cell.myimage setImageWithURL:[NSURL URLWithString:appRecord.imageURLString]
placeholderImage:[UIImage imageNamed:@"BackgorundLogoCell.png"]];
cell.detalleText.text = appRecord.artist;
return cell;
}
ParseOperation.m
#import "ParseOperation.h"
#import "AppRecord.h"
#import "TFHpple.h"
#import "TFHppleElement+KeyedSubcript.h"
@interface ParseOperation ()
@property (nonatomic, copy) ArrayBlock completionHandler;
@property (nonatomic, strong) NSData *dataToParse;
@end
@implementation ParseOperation
- (id) initWithData:(NSData *)data
completionHandler:(ArrayBlock)handler
{
self = [super init];
if (self != nil)
{
self.dataToParse = data;
self.completionHandler = handler;
}
return self;
}
- (void)main
{
NSMutableArray *workingArray = [NSMutableArray array];
TFHpple *appParser = [TFHpple hppleWithXMLData:self.dataToParse];
NSString *appXpathQueryString = @"//xmlns:entry";
NSArray *appsArray = [appParser searchWithXPathQuery:appXpathQueryString];
for (TFHppleElement *element in appsArray) {
AppRecord *app = [[AppRecord alloc] init];
app.appName = [[element firstChildWithTagName:@"title"] text];
app.imageURLString = [[element firstChildWithTagName:@"image"] text ];
app.artist = [[element firstChildWithTagName:@"pastor"] text];
app.appDuration = [[element firstChildWithTagName:@"duration"] text];
app.appDate = [[element firstChildWithTagName:@"date"] text];
app.appUrl = [[element firstChildWithTagName:@"url"] text];
[workingArray addObject:app];
}
self.completionHandler(workingArray);
self.dataToParse = nil;
}