i have a UITableView in a storyboard in an ios xcode project,
i also have an array of menuitem
objects stored in itemarray
:
NSMutableArray *itemarray;
this is my menuitem.h file
#import <Foundation/Foundation.h>
@interface menuitem : NSObject
@property (nonatomic) NSString *itemtitle;
@property (nonatomic) NSString *itemdesc;
@property (nonatomic) int itemid;
@property (nonatomic) int itemprice;
@property (nonatomic) NSString *itemcat;
@end
this is my tableviewcell.m file:
#import "tableviewcell.h"
#import "menuitem.h"
@interface tableviewcell ()
@property (nonatomic, weak) IBOutlet UILabel *titleLabel;
@property (nonatomic, weak) IBOutlet UILabel *descLabel;
@property (nonatomic, weak) IBOutlet UILabel *priceLabel;
@end
@implementation tableviewcell
-(void)configureWithmenuitem:(menuitem *)item{
NSLog(@"hello");
self.titleLabel.text = item.itemtitle;
self.descLabel.text = item.itemdesc;
self.priceLabel.text = [NSString stringWithFormat:@"%.1d", item.itemprice];
}
@end
i want to get the itemtitle
, itemdesc
and itemprice
from each instance of menuitem
into 3 labels on each of the tableviewcell
s