iPhone/iOS: Subclassing UITableViewCell two times --> cannot reference properties of parentclass in InterfaceBuilder
I want to use UITableViewCells wi开发者_如何学Cthin my application which have an image, and that image is downloaded asynchronously. Too accomplish that and to make sure that I dont have to write the same code several times within my application I subclassed UITableViewCell like so:
#import <UIKit/UIKit.h>
@interface ImageCell : UITableViewCell {
UIImageView* imageView;
}
@property (nonatomic, retain) UIImageView* imageView;
@end
Everytime I need a Cell with an image I would like to subclass the ImageCell like so:
#import <UIKit/UIKit.h>
#import "ImageCell.h"
@interface StoreCell : ImageCell {
UILabel* streetAddress;
UILabel* retailerName;
UILabel* distance;
}
@property (nonatomic, retain) IBOutlet UILabel* streetAddress;
@property (nonatomic, retain) IBOutlet UILabel* retailerName;
@property (nonatomic, retain) IBOutlet UILabel* distance;
@end
However this doesnt seem to work. Since StoreCell is subclassing ImageCell I cant reference the property "imageView" anymore within the InterfaceBuilder.
Am I missing something here? Is this subclassing-scheme I'm trying to accomplish not meant to be in Objective-C / iPhone OS?
I think you need to tell interface builder about it using IBOutlet ... so
@property (nonatomic, retain) IBOutlet UIImageView* imageView;
精彩评论