2

I have subclassed and am using UIPopoverBackgroundView in order to make custom appearances for my UIPopoverControllers. Everything seems to work great so far, the popover draws well and looks the way I expect it.
The issue is that, when my popover is left open for a period of time with no activity, the border will often suddenly be drawn wrong. This specifically seems to only happen when the popover contains a scrollview/tableview which is larger than the popover (i.e. it is scrollable). It also doesn't happen every time, but if it does happen, it occurs in less than one minute of inactivity. If I take a screenshot, the issue is not visible (despite it clearly being seen on screen) so I can't provide any images of the issue unfortunately.

Does anyone know of any reason why the border would be drawn incorrectly after several seconds of inactivity and how to fix the issue? I can provide snippets of code if necessary, though I'm fairly certain everything is right (and equivalent to the many examples I've seen online). I also do not resize the popover at any time during the inactivity (I do resize when initially displayed to fit the content up to a maximum size).

Since I can't take a screenshot to demonstrate the issue, the best I can do is describe it. It appears as if the border in certain areas is drawn at the wrong size (as in, part of the right edge is being drawn in the middle of the popover; NOT that the border itself is too wide, but rather that the area the border should be bordering is wrong). The area along the actual edge is still there, but is lacking it's layer effects (I have the backgroundView using a border and rounded corner layer effect to give it a nice rounded white edge, emulating the same appearance as the default background view, just a different color). Removing the layer effects does not prevent the issue though. Sometimes it's only a part of the right edge which is drawn incorrectly, sometimes part of the bottom edge is also affected. I can't seem to find any correlation as to when or how this happens (though it is frequent), nor to which edge is affected (though I've never seen it affect the top or left edge).

Doc
  • 1,480
  • 2
  • 16
  • 28
  • Added more descriptive details since I'm unable to take a screenshot of the issue. – Doc Jul 17 '13 at 18:47

1 Answers1

1

Does it only happen in the simulator or also on a real device?

This specifically seems to only happen when the popover contains a scrollview/tableview which is larger than the popover (i.e. it is scrollable)

Do you resize the scrollview / tableview in this case? Try adding a UIView inside your UIPopView that would be the container.

floflo67
  • 41
  • 5
  • This happens on the device. I unfortunately cannot run my code on the simulator, some of the libraries I use aren't compatible with it. All of my popovers contain a navigation controller, which in turn have the root view being a UIViewController or UITableViewController. In either case, I don't explicitly set the size of the view. I only set the size of the popover initially so that it wont be any taller than 2/3rds the height of the screen, and 1/2 the width. – Doc Jul 24 '13 at 14:26
  • I also tried making the root view of the UINavigationController that the popover contains a UIViewController which in turn contains my table view. The issue still occurred. – Doc Jul 31 '13 at 15:49