首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用UIComponents自定义UITableViewCell内部的IBOutlets

使用UIComponents自定义UITableViewCell内部的IBOutlets
EN

Stack Overflow用户
提问于 2018-04-11 07:34:12
回答 1查看 70关注 0票数 0

我用xib做了一个xib,在里面我在定制的tableViewCell类中做了一个UIViewIBoutlet。我想设置那个UIView的边框颜色。

我的tableViewCell.h代码

代码语言:javascript
复制
@property (weak, nonatomic) IBOutlet UIView *circleView;

tableViewCell.m

代码语言:javascript
复制
#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

但这不管用。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2018-04-11 07:35:54

把代码放进去

代码语言:javascript
复制
 - (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;

 }
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/49769110

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档