我正在製作博客閱讀器應用程序。一切正常,直到我嘗試從單元格訪問detailView。我收到此錯誤,無法設置屬性
[UINavigationController setPFeedURL:]: unrecognised selector sent to instance 0x7f96d5802800
下面的代碼是在PRTableViewController.m
#import "PRTableViewController.h"
#import "PRFeedPost.h"
#import "PRDetailViewController.h"
這是代碼是在崩潰發生
-(void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{
if ([segue.identifier isEqualToString:@"showDetail"]){
NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow];
PRFeedPost *feed_Post = [self.polisenFeed objectAtIndex:indexPath.row];
[segue.destinationViewController setPFeedURL:feed_Post.url];
}
}
這是爲了幫助你明白我正在嘗試設置FeedFeL。此外,在PRViewTableController.m
self.polisenFeed = [NSMutableArray array];
NSArray *polisenFeedArray = [dataDictionary objectForKey:@"posts"];
for (NSDictionary *postDictionary in polisenFeedArray) {
PRFeedPost *fp = [PRFeedPost feedWithTitle:[postDictionary objectForKey:@"title"]];
fp.author = [postDictionary objectForKey:@"author"];
fp.thumbnail = [postDictionary objectForKey:@"thumbnail"];
fp.date = [postDictionary objectForKey:@"date"];
fp.url = [NSURL URLWithString:[postDictionary objectForKey:@"url" ]];
[self.polisenFeed addObject:fp];
}
現在PRDetailViewController.h,
這是該屬性是我想設置爲,
@property (strong, nonatomic) NSURL *pFeedURL;
@property (strong, nonatomic) id detailItem;
@property (strong, nonatomic) IBOutlet UIWebView *webView;
這裏是PRDetailViewController.m代碼,
- (void)viewDidLoad {
[super viewDidLoad];
NSURLRequest *urlRequest = [NSURLRequest requestWithURL:self.pFeedURL];
[self.webView loadRequest:urlRequest];
我似乎無法弄清楚爲什麼會崩潰。我知道它有這行做的,
[segue.destinationViewController setPFeedURL:feed_Post.url];
(在leaset我認爲這是該行。我想不通,爲什麼我不能對它進行設置。
感謝您的幫助傢伙!
感謝您的回覆techloverr,但我得到的錯誤是「爲UIViewController中沒有可見的接口聲明的選擇setPFeedURL」 – Ro4ch
你試過嗎? – techloverr