Skip to content

Instantly share code, notes, and snippets.

@lubiepomaranczki
Created February 17, 2019 18:08
Show Gist options
  • Save lubiepomaranczki/bea698576cd43087fcd6ced4b7eb58f0 to your computer and use it in GitHub Desktop.
Save lubiepomaranczki/bea698576cd43087fcd6ced4b7eb58f0 to your computer and use it in GitHub Desktop.
BookHeader for SectionedCollectionView
public class BookHeader : UICollectionReusableView
{
public static readonly NSString Key = new NSString("BookHeader");
private UILabel headerText;
public string HeaderText
{
get { return headerText.Text; }
set
{
headerText.Text = value;
SetNeedsDisplay();
}
}
[Export("initWithFrame:")]
public BookHeader(System.Drawing.RectangleF frame)
: base(frame)
{
BackgroundColor = UIColor.FromRGBA(170, 170, 170, 170);
headerText = new UILabel
{
TranslatesAutoresizingMaskIntoConstraints = false,
TextColor = UIColor.FromRGB(245, 241, 230),
TextAlignment = UITextAlignment.Center
};
AddSubview(headerText);
headerText.LeftAnchor.ConstraintEqualTo(LeftAnchor).Active = true;
headerText.RightAnchor.ConstraintEqualTo(RightAnchor).Active = true;
headerText.CenterYAnchor.ConstraintEqualTo(CenterYAnchor).Active = true;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment