void ReleaseDesignerOutlets() { if (ExpiredDateLabel != null) { ExpiredDateLabel.Dispose(); ExpiredDateLabel = null; } if (ExpireInfoButton != null) { ExpireInfoButton.Dispose(); ExpireInfoButton = null; } if (ExpireInfoView != null) { ExpireInfoView.Dispose(); ExpireInfoView = null; } if (FilterNavigationBar != null) { FilterNavigationBar.Dispose(); FilterNavigationBar = null; } if (FilterSegmentControl != null) { FilterSegmentControl.Dispose(); FilterSegmentControl = null; } }
public override void ViewDidLoad() { base.ViewDidLoad(); ExpireInfoView.AddGestureRecognizer(new UITapGestureRecognizer(AppDisplayUtil.Instance.ShowPublicationInfoView)); ShowExpireInfoView(); tocTableViewVC = new TableOfContentTableViewController(); TOCNode rootNode = AppDataUtil.Instance.GetCurPublicationTocRootNode(); if (rootNode != null && rootNode.ChildNodes != null && rootNode.ChildNodes.Count > 0) { tocTableViewSource = new TableOfContentTableViewSource(rootNode); tocTableViewVC.TableView.Source = tocTableViewSource; tocTableViewVC.TableView.TranslatesAutoresizingMaskIntoConstraints = false; tocTableViewVC.TableView.TableFooterView = new UIView(); //hidden redundant line separator ContainerView.AddSubview(tocTableViewVC.TableView); ContainerView.AddConstraints(new NSLayoutConstraint[] { NSLayoutConstraint.Create(tocTableViewVC.TableView, NSLayoutAttribute.Top, NSLayoutRelation.Equal, ContainerView, NSLayoutAttribute.Top, 1, 0), NSLayoutConstraint.Create(tocTableViewVC.TableView, NSLayoutAttribute.Bottom, NSLayoutRelation.Equal, ContainerView, NSLayoutAttribute.Bottom, 1, 0), NSLayoutConstraint.Create(tocTableViewVC.TableView, NSLayoutAttribute.Leading, NSLayoutRelation.Equal, ContainerView, NSLayoutAttribute.Leading, 1, 0), NSLayoutConstraint.Create(tocTableViewVC.TableView, NSLayoutAttribute.Trailing, NSLayoutRelation.Equal, ContainerView, NSLayoutAttribute.Trailing, 1, 0) }); AppDataUtil.Instance.AddOpenedContentObserver(this); //Set current instance as the observer of subject OpendPublication to get notification when opend content changed } AppDisplayUtil.Instance.TOCVC = this; SearchBar.Delegate = new TOCSearchBarDelegate(); //hide search bar border SearchBar.Layer.BorderWidth = 1; SearchBar.Layer.BorderColor = UIColor.FromRGB(194, 194, 194).CGColor; }
void ReleaseDesignerOutlets() { if (ExpiredDateLabel != null) { ExpiredDateLabel.Dispose(); ExpiredDateLabel = null; } if (ExpireInfoButton != null) { ExpireInfoButton.Dispose(); ExpireInfoButton = null; } if (ExpireInfoView != null) { ExpireInfoView.Dispose(); ExpireInfoView = null; } if (SearchBar != null) { SearchBar.Dispose(); SearchBar = null; } if (ContainerView != null) { ContainerView.Dispose(); ContainerView = null; } }
private void ShowExpireInfoView() { bool isExpireInfoViewAppear = AppDataUtil.Instance.GetCurrentPublication().DaysRemaining < 0 ? true : false; if (isExpireInfoViewAppear) { UILabel expireLabel = new UILabel(new CGRect(15, 5, 100, 20)); expireLabel.Font = UIFont.SystemFontOfSize(14); expireLabel.TextColor = UIColor.White; expireLabel.Text = "Expired"; UILabel dateLabel = new UILabel(new CGRect(15, 25, 256, 14)); dateLabel.Font = UIFont.SystemFontOfSize(12); dateLabel.TextColor = UIColor.LightTextColor; dateLabel.Text = "Currency Date " + ((DateTime)AppDataUtil.Instance.GetCurrentPublication().LastUpdatedDate).ToString("dd MMM yyyy"); UIButton infoButton = new UIButton(UIButtonType.DetailDisclosure); infoButton.Frame = new CGRect(288, 11, 22, 22); infoButton.TintColor = UIColor.White; infoButton.TouchUpInside += (object sender, EventArgs e) => AppDisplayUtil.Instance.ShowPublicationInfoView(); ExpireInfoView.AddSubviews(new UIView[] { expireLabel, dateLabel, infoButton }); for (int i = 0; i < ExpireInfoView.Constraints.Length; i++) { if (ExpireInfoView.Constraints [i].FirstAttribute == NSLayoutAttribute.Height) { ExpireInfoView.Constraints [i].Constant = 44; } } } else { foreach (var subView in ExpireInfoView.Subviews) { subView.RemoveFromSuperview(); } for (int i = 0; i < ExpireInfoView.Constraints.Length; i++) { if (ExpireInfoView.Constraints [i].FirstAttribute == NSLayoutAttribute.Height) { ExpireInfoView.Constraints [i].Constant = 0; } } } }