【发布时间】:2019-06-03 10:40:12
【问题描述】:
我将我的UIImageView 设为我的UITableViewCell 中的圈子。所以我在GetCell 方法中做了这样的事情,如下所示。
public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
{
UITableViewCell cell = tableView.DequeueReusableCell(_cellIdentifier);
RemotesupportAgentData item = _tableItems[indexPath.Row];
//---- if there are no cells to reuse, create a new one
if (cell == null)
{
cell = new UITableViewCell(UITableViewCellStyle.Default, _cellIdentifier);
cell.SelectionStyle = UITableViewCellSelectionStyle.None;
}
cell.TextLabel.Text = (string)item.Attributes["Name"];
cell.ImageView.SetImage(new NSUrl((string)item.Attributes["avatar"]), UIImage.FromBundle("contacts-32.png"));
cell.ImageView.ClipsToBounds = true;
cell.ImageView.Layer.CornerRadius = cell.ImageView.Frame.Width / 2;
cell.ImageView.Layer.BorderColor = UIColor.Green.CGColor;
cell.ImageView.Layer.BorderWidth = (nfloat)2.0;
return cell;
}
我的问题是,最初,当我滚动时,这个图像视图加载为正方形,只有它自己变成圆形。我该如何解决这个问题?
【问题讨论】:
标签: uitableview xamarin.ios uiimageview