UIRelativeLayout content = new UIRelativeLayout();
cell.AddSubview(content);
content.Frame = cell.Bounds;
content.AutoresizingMask = UIViewAutoresizing.All;
content.GetLayoutParams().AddLayoutRule(LayoutRule.CenterInParent);
//content.LayoutMargins = new UIEdgeInsets(5, 5, 5, 5);
// make a UITableViewCell with a clickable button
cell.TextLabel.Text = model.Button.Description;
UIButton button = new UIButton();
button.BackgroundColor = UIColor.Orange;
button.GetLayoutParams().AddLayoutRule(LayoutRule.CenterInParent);
button.GetLayoutParams().AddLayoutRule(LayoutRule.RightOf, content);
button.GetLayoutParams().Frame = new CoreGraphics.CGRect(LayoutParams.UNSPECIFIED, LayoutParams.UNSPECIFIED, 25, 25);
//debug.GetLayoutParams().AddLayoutRule(LayoutRule.RightOf, _view);
button.TouchUpInside += (sender, e) =>
{
model.Button.OnClick.Execute(null);
};
content.AddSubview(button);
答案 0 :(得分:0)
而不是:
view.Frame = new CoreGraphics.CGRect(view.Frame.Y, pos.Y, view.Frame.Width, view.Frame.Height);
使用:
view.Frame = new CoreGraphics.CGRect(pos.X, view.Frame.Y, view.Frame.Width, view.Frame.Height);
仅供参考:
您向上/向下滑动似乎应该使用Frame.X
与Frame.Y
,除非您尝试执行UIView
的对角线移动:
view.Frame = new CoreGraphics.CGRect(view.Frame.X, pos.Y, view.Frame.Width, view.Frame.Height);