it seems just weird as i can't solve it and stuck over it. I use a storyboard to navigate between a tableview and a detailview. It worked great when I passed a single object (NewsRecord) from my tableview class (TopStoriesViewController) to my detail class (DetailNewsViewController). But now I need to pass an array of objects (NewsRecord) when going into the part class instead of one (NewsRecord) object. But when I create NSArray * in my verbose class and try to access it in my tableview class in the prepareForSegue method using the object of the detail class, it gives the following error: the properties of the elements were not found on an object of the type DetailNewsViewController * at compile time . items is an NSArray object that gets its contents from the "records", which is also an NSArray in the TopStoriesViewController class.
My question is why can I access getNewsDetails from the DetailNewsViewController in the TopStoriesViewController and not in the elements.
My classes are as follows: TopStoriesViewController.m
#import "DetailNewsViewController.h" some code here.... - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { if ([[segue identifier] isEqualToString:@"ShowDetailedNews"]) { DetailNewsViewController *detailNewsVC = [segue destinationViewController]; [segue.destinationViewController setHidesBottomBarWhenPushed:YES]; NSInteger indexForNewsSelectedFromTBV = [[self.tableView indexPathForSelectedRow] row]; [detailNewsVC setGetNewsDetails:[entries objectAtIndex:indexForNewsSelectedFromTBV]];
DetailNewsViewController.h
#import "NewsRecord.h" @interface DetailNewsViewController : UIViewController { NewsRecord *getNewsDetails; some other declarations... NSArray *items; } @property(nonatomic,retain) NewsRecord *getNewsDetails; @property(nonatomic,retain) NSArray *items; @end
DetailNewsViewController.m
#import "DetailNewsViewController.h" @synthesize getNewsDetails,items;
NewsRecord.h
@interface NewsRecord : NSObject { NSString *newsTitle; NSString *newsDescription; } @property(nonatomic,retain) NSString *newsTitle; @property(nonatomic,retain) NSString *newsDescription; @end
source share