public HistoryItem(Rock.Client.Family family, OnHistoryItemClick onClick) { // store the family Family = family; // create the button and add its click handler Button = UIButton.FromType(UIButtonType.System); Button.SetTitle(UI.FamilySuffixManager.FamilyNameNoSuffix(Family.Name), UIControlState.Normal); Button.SetTitleColor(Theme.GetColor(Config.Instance.VisualSettings.FooterTextColor), UIControlState.Normal); // now measure the button label NSString createLabel = new NSString(UI.FamilySuffixManager.FamilyNameNoSuffix(Family.Name)); CGSize buttonSize = createLabel.StringSize(Button.Font); Button.Bounds = new CGRect(0, 0, buttonSize.Width, buttonSize.Height); Button.TouchUpInside += delegate { onClick(Family); }; }
public HistoryItem( Rock.Client.Family family, OnHistoryItemClick onClick ) { // store the family Family = family; // create the button and add its click handler Button = UIButton.FromType( UIButtonType.System ); Button.SetTitle( UI.FamilySuffixManager.FamilyNameNoSuffix( Family.Name ), UIControlState.Normal ); Button.SetTitleColor( Theme.GetColor( Config.Instance.VisualSettings.FooterTextColor ), UIControlState.Normal ); // now measure the button label NSString createLabel = new NSString( UI.FamilySuffixManager.FamilyNameNoSuffix( Family.Name ) ); CGSize buttonSize = createLabel.StringSize( Button.Font ); Button.Bounds = new CGRect( 0, 0, buttonSize.Width, buttonSize.Height ); Button.TouchUpInside += delegate { onClick( Family ); }; }