0

I have made a UITableViewCell with xib, inside it I have made a UIView and made IBoutlet in my custom tableViewCell class. I want to set the border color of that UIView.

My code in tableViewCell.h:

@property (weak, nonatomic) IBOutlet UIView *circleView;

In tableViewCell.m:

#import "OUSTProfileTableViewCell.h"

@implementation OUSTProfileTableViewCell
//@synthesize circleView = _circleView;

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {

    }
    return self;
}
- (instancetype)initWithCoder:(NSCoder *)coder
{
    self = [super initWithCoder:coder];
    if (self) {
        self.circleView.layer.cornerRadius = 3; // this value vary as per your desire
        self.circleView.layer.masksToBounds = YES;
        self.circleView.layer.borderWidth = 2.0;
        self.circleView.layer.borderColor = (__bridge CGColorRef _Nullable)([UIColor lightGrayColor]);
    }
    return self;
}


@end

But it's not working.

Erik Cederstrand
  • 8,820
  • 7
  • 37
  • 60
k . kishore
  • 69
  • 1
  • 8

1 Answers1

0

Put code inside

 - (void)awakeFromNib {
  [super awakeFromNib];
  // Initialization code

    self.circleView.layer.cornerRadius = 3; // this value vary as per your desire
    self.circleView.layer.masksToBounds = YES;
    self.circleView.layer.borderWidth = 2.0;
    self.circleView.layer.borderColor = [UIColor lightGrayColor].CGColor;

 }
Sh_Khan
  • 93,445
  • 7
  • 57
  • 76