Skip to content

Commit

Permalink
Merge pull request #27 from dotMorten/RgPopupBug
Browse files Browse the repository at this point in the history
Ensure the active window is used
  • Loading branch information
dotMorten authored Jan 16, 2019
2 parents ffe8557 + 29f9748 commit b3ff215
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,11 @@ public bool IsSuggestionListOpen
{
if (value && selectionList.Superview == null && selectionList.Source != null && selectionList.Source.RowsInSection(selectionList, 0) > 0)
{
UIKit.UIApplication.SharedApplication.Windows[0].AddSubview(selectionList);
var viewController = UIApplication.SharedApplication.Windows.FirstOrDefault(w => w.RootViewController != null && w.IsKeyWindow) ??
UIApplication.SharedApplication.Windows.FirstOrDefault(w => w.RootViewController != null);
if (viewController == null)
return;
viewController.Add(selectionList);
selectionList.TopAnchor.ConstraintEqualTo(inputText.BottomAnchor).Active = true;
selectionList.LeftAnchor.ConstraintEqualTo(inputText.LeftAnchor).Active = true;
selectionList.WidthAnchor.ConstraintEqualTo(inputText.WidthAnchor).Active = true;
Expand Down

0 comments on commit b3ff215

Please sign in to comment.