class FriendCell : BaseCell<string>
{
protected internal FriendCell(IntPtr handle) : base(handle)
{
}
public override void Init(IList<string> source, NSIndexPath path)
{
UILabel label1 = new UILabel
{
Text = "test",
TextAlignment=UITextAlignment.Center,
BackgroundColor = UIColor.White,
};
label1.SizeToFit();
UILabel label2 = new UILabel
{
Text = "test2",
TextAlignment = UITextAlignment.Center,
BackgroundColor = UIColor.White,
};
UILabel label3= new UILabel
{
Text = "test3",
TextAlignment = UITextAlignment.Center,
BackgroundColor = UIColor.White,
};
SfPopupLayout popupLayout = new SfPopupLayout();
popupLayout.PopupView.PopupStyle.OverlayOpacity = 0;
popupLayout.PopupView.ShowHeader = false;
popupLayout.PopupView.ShowFooter = false;
popupLayout.PopupView.ContentView = new UIStackView(new UIView[] { label1, label2, label3 })
{
Frame=new CGRect(0,0,100,100),
Axis = UILayoutConstraintAxis.Vertical,
Distribution = UIStackViewDistribution.FillEqually,
Alignment=UIStackViewAlignment.Top,
BackgroundColor=UIColor.LightGray,
};
//popupLayout.PopupView.ContentView.Bounds = new CGRect(0, 20, 100, 100);
//popupLayout.PopupView.ContentView.BackgroundColor = UIColor.LightGray;
UILabel labelName = new UILabel
{
Text = source[path.Row],
Font = UIFont.SystemFontOfSize(20),
};
UILabel labelMsg = new UILabel
{
Lines = 1,
Text = "msg",
LineBreakMode=UILineBreakMode.TailTruncation,
Font = UIFont.SystemFontOfSize(16),
};
UIButton labelMore = new UIButton(UIButtonType.System)
{
Font = UIFont.FromName("FontAwesome", 24),
UserInteractionEnabled=true,
};
labelMore.SetTitle("\uF142", UIControlState.Normal);
labelMore.SetContentHuggingPriority(260, UILayoutConstraintAxis.Horizontal);
labelMore.AddGestureRecognizer(new UITapGestureRecognizer(() =>
{
//popupLayout.ShowRelativeToView(labelMore,RelativePosition.AlignTopLeft,0,0);
popupLayout.Show();
}));
UIStackView stack2 = new UIStackView(new UIView[] { labelName, labelMsg })
{
Axis = UILayoutConstraintAxis.Vertical,
Distribution=UIStackViewDistribution.Fill,
};
UIStackView stack1 = new UIStackView(new UIView[] { stack2, labelMore })
{
TranslatesAutoresizingMaskIntoConstraints=false,
Axis = UILayoutConstraintAxis.Horizontal,
Distribution = UIStackViewDistribution.Fill,
};
ContentView.AddSubview(stack1);
stack1.TopAnchor.ConstraintEqualTo(ContentView.TopAnchor,4).Active = true;
stack1.LeadingAnchor.ConstraintEqualTo(ContentView.LeadingAnchor,8).Active = true;
stack1.TrailingAnchor.ConstraintEqualTo(ContentView.TrailingAnchor,-16).Active = true;
stack1.BottomAnchor.ConstraintEqualTo(ContentView.BottomAnchor,-8).Active = true;
}
}
FriendCell is UITableViewCell.
I cant change contentview height.
How to change contentview height?
Attachment:
screenshot_cfdc243b.zip