カスタム テーブル セルがあり、ラベル、画像などを設定しようとしていますが、何らかの理由で機能しません。
これが私のカスタムセルのコードです
BrowserMenuCell.h
#import <UIKit/UIKit.h>
@interface BrowseMenuCell : UITableViewCell
@property (strong, nonatomic) IBOutlet UIButton *wishListBUtton;
@property (strong, nonatomic) IBOutlet UIImageView *itemImage;
@property (strong, nonatomic) IBOutlet UILabel *itemLabel;
@property (strong, nonatomic) IBOutlet UILabel *itemPrice;
@property (strong, nonatomic) IBOutlet UITextField *quantityField;
@property (strong, nonatomic) IBOutlet UILabel *totalLabel;
- (IBAction)plusButton:(id)sender;
- (IBAction)cartButton:(id)sender;
- (IBAction)minusButton:(id)sender;
@end
BrowserMenuCell.m
#import "BrowseMenuCell.h"
@implementation BrowseMenuCell
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
// Initialization code
}
return self;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
- (IBAction)plusButton:(id)sender {
}
- (IBAction)cartButton:(id)sender {
}
- (IBAction)minusButton:(id)sender {
}
@end
インデックス パスの行のセル
-(UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath {
BrowseMenuCell *cell = [tableView dequeueReusableCellWithIdentifier:@"ItemsCell"];
OfficeSupply *supply = [_items objectAtIndex:indexPath.row];
if(cell == nil)
{
NSArray * views = [[NSBundle mainBundle] loadNibNamed:@"BrowseMenuCell" owner:nil options:nil];
for (id obj in views){
if([obj isKindOfClass:[UITableViewCell class]])
{
BrowseMenuCell * obj = [[BrowseMenuCell alloc]init];
obj.itemLabel.text = supply.itemName;
cell = obj;
break;
}
}
}
return cell;
}