Well, I'm completely stumped here.
This works in CouponListViewController.m:
- (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; self.couponList = [CouponDatabase database].couponList; self.title = @"Coupon List"; }
And this works in CouponDetailViewController.m:
- (void)viewWillAppear:(BOOL)animated { CouponDetails *details = [[CouponDatabase database] couponDetails:_uniqueId]; if (details != nil) { [_merchantNameLabel setText:details.merchantName]; [_longDealLine1Label setText:details.longDealLine1];
But when I change CouponDatabase.h from this (which works with the above):
@class CouponDetails; @interface CouponDatabase : NSObject { sqlite3 *_database; } + (CouponDatabase *)database; - (NSArray *)couponList; - (CouponDetails *)couponDetails:(int) uniqueId;
... to this (which works if I manually set the value "selectedCategory" inside the method):
@class CouponList; @class CouponDetails; @interface CouponDatabase : NSObject { sqlite3 *_database; } + (CouponDatabase *)database; - (CouponList *)couponList:(int) selectedCategory; - (CouponDetails *)couponDetails:(int) uniqueId;
and then change CouponListViewController.m to:
1 - (void)viewWillAppear:(BOOL)animated { 2 [super viewWillAppear:animated]; 3 self.couponList = [[CouponDatabase database] couponList:_selectedCategory]; 4 self.title = @"Coupon List"; 5 }
I get this error on line 3 above:
warning: incompatible Objective-C types 'struct CouponList *', expected 'struct NSArray *' when passing argument 1 of 'setCouponList:' from distinct Objective-C type
Question: What is the proper formatting of the self.couponlist string so that I can pass an integer to the coupon database for use in the couponList method?
EDIT: I know couponDetails is now a class instead of an array - I just don't know how to format a row to initialize table data.
I hope this makes sense - any help in this would be greatly appreciated.
Thanks in advance!
Adding CouponListViewController.h: