Tuesday, 10 September 2013

Loading a UIImageView subclass from a custom cell

Loading a UIImageView subclass from a custom cell

I am not sure if this is a Storyboard Bug. I have created a project with a
custom cell.
- (UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"HomeGameTurnCell";
HomeTableViewCell *cell = [tableView
dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[HomeTableViewCell alloc]
initWithStyle:UITableViewCellStyleDefault
reuseIdentifier:CellIdentifier];
}
The custom cell has some image views. One of the image views is a subclass.
@interface HomeTableViewCell : UITableViewCell
@property (strong, nonatomic) IBOutlet RoundedProfilePicture
*profilePictureImageView;
@property (strong, nonatomic) IBOutlet UIImageView *turnThumbnailImage;
@property (strong, nonatomic) IBOutlet UILabel *usernameLabel;
@property (strong, nonatomic) IBOutlet UILabel *lastPlayedLabel;
@end
The RoundedProfilePicture subclass simply has the following:
-(id)init {
NSLog(@"%s",__PRETTY_FUNCTION__);
self = [super init];
if (self) {
[self setupView];
}
return self;
}
- (void)setupView
{
NSLog(@"%s",__PRETTY_FUNCTION__);
self.clipsToBounds = YES;
self.layer.cornerRadius = self.bounds.size.width / 2;
self.layer.borderWidth = 3;
self.layer.borderColor = [UIColor darkGrayColor].CGColor;
}
What I am finding is that the RoundedProfilePicture methods are not being
called. Within the storyboard I have setup one prototype cell and the
correct identifier. I also have the image view set as the correct Custom
class. But it doesn't seem to take effect, is there something I am
missing/could check?

No comments:

Post a Comment