nib ファイルにある幅を取得して円にしようとしてUIImageView
いますが、間違った値を取得しています
これが私のコードです:
- (void)viewDidLoad {
[super viewDidLoad];
//....
UINib *cellNib = [UINib nibWithNibName:@"User_Row" bundle:nil];
[_Menu_Table registerNib:cellNib forCellReuseIdentifier:@"user_row"];
}
テーブルビューで:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
User_Row *user_row = [tableView dequeueReusableCellWithIdentifier:@"user_row"];
if (user_row == nil){
NSArray *nibs = [[NSBundle mainBundle] loadNibNamed:@"User_Row" owner:self options:nil];
user_row = (User_Row *)[nibs objectAtIndex:0];
}
[user_row.user_image layoutIfNeeded];
user_row.user_image.layer.borderWidth = 3;
user_row.user_image.layer.borderColor = [UIColor colorWithRed:40/255 green:62/255 blue:38/255 alpha:1].CGColor;
CALayer *cellImageLayer = user_row.user_image.layer;
NSLog(@"width is %f", user_row.user_image.frame.size.width);
[cellImageLayer setCornerRadius:user_row.user_image.frame.size.width/2];
[cellImageLayer setMasksToBounds:YES];
return user_row;
}