I was wondering if anyone has come across a weird flicker/animation with the PopoverPresentationController. The flicker occurs when there is a textField becomes the first responder. The popover appears to almost re-open on-top of an existing popover.
Steps/App Breakdown:
MainViewController - UIViewController with tableview
public override void ViewDidLoad() {
base.ViewDidLoad();
source = new TableSource(this);
tableView = new UITableView(CoreGraphics.CGRect.Empty, UITableViewStyle.Grouped);
tableView.TranslatesAutoresizingMaskIntoConstraints = false;
tableView.RegisterClassForCellReuse(typeof(TableViewCell), "test");
tableView.Source = source;
View.AddSubview(tableView);
source.Source.Add(new List<string> {
"Section 1, text Element 0",
"Section 1, text Element 1",
"Section 1, text Element 2",
"Section 1, text Element 3",
"Section 1, text Element 4",
"Section 1, text Element 5",
"Section 1, text Element 6",
});
tableView.TopAnchor.ConstraintEqualTo(View.TopAnchor).Active = true;
tableView.LeftAnchor.ConstraintEqualTo(View.LeftAnchor).Active = true;
tableView.RightAnchor.ConstraintEqualTo(View.RightAnchor).Active = true;
tableView.BottomAnchor.ConstraintEqualTo(View.BottomAnchor).Active = true;
}
PopoverView - UIViewController with a simple TextField
public class PopoverView: UIViewController {
public override void ViewDidLoad() {
base.ViewDidLoad();
UITextField field = new UITextField(new CGRect(20,10, 150, 44));
field.BackgroundColor = UIColor.White;
View.AddSubview(field);
}
}
1) Click a cell
public override void RowSelected(UITableView tableView, NSIndexPath indexPath) {
PopoverView view = new PopoverView();
view.View.BackgroundColor = UIColor.LightGray;
view.ModalPresentationStyle = UIModalPresentationStyle.Popover;
view.PopoverPresentationController.SourceRect = new CoreGraphics.CGRect(0, 40, 100, 100);
view.PopoverPresentationController.SourceView = tableView;
view.PreferredContentSize = new CoreGraphics.CGSize(300, 1000);
controller.PresentViewController(view, true, null);
}
2) launches the popover
3) click the textField
If I change the following line in RowSelected:
view.PopoverPresentationController.SourceRect = new CoreGraphics.CGRect(0, 40, 100, 100);
to:
view.PopoverPresentationController.SourceRect = new CoreGraphics.CGRect(0, 0, 100, 100);
the flicker stops however that doesn't help if the popover is linked to tableview cells in different places on screen.