-1

A UI component in my app has a minor but nasty visual glitch. The glitch goes away completely if I rotate the device to landscape and back to portrait. So, maybe there is an easy way to reproduce such full refresh of the whole scene programmatically, without forcing the user to manipulate the device and with minimal visual effect?

The component is written in C# (Xamarin), if that happens to matter, and I don't have access to its code to fix the bug there.

Alex Cohn
  • 56,089
  • 9
  • 113
  • 307
  • You've given us nothing to help reproduce this issue, which makes it really hard to know what the issue is. At the very least, could you detail what *"nasty visual glitch"* means? I don't use Xamarin, but like Objective-C and Swift, there is a "life cycle" in both a `UIViewController1` and `UIView`. Device rotation triggers several of these - particularly if you are using auto layout (something else you haven't detailed). A more detailed description would certainly help. –  Nov 07 '19 at 23:46
  • @dfd Whether the component uses auto layout or not, I don't know. The specifics of the nasty visual glitch are entirely irrelevant, because it simply doesn't happen after rotation (rotation that happens before the component is displayed), and I am not allowed change its code anyway. – Alex Cohn Nov 08 '19 at 14:08
  • 1
    Well, first - for the record I'm *not* one of the two downvotes. Just trying to help. With what little you've given to go on? It's rather hard.... To force a refresh, one *might* look in three directions. (1) What I already said, view & VC lifecycles. (2) I guess one could check into AppDelegate and SceneDelegate, but those are really controlled by the OS. Finally, (3) maybe some type of draw override. Of course, there's always the last option - get rid of (or replace) the component, which sounds like it's a third party kind of thing. Good luck. –  Nov 08 '19 at 19:05
  • @dfd I am aware of view and controller lifecycles. And in my app, their behaviour is correct: having been invoked (by the system}, they fix the 3rd party glitch entirely. I can force the app to switch to landscape and back to portrait, but this has an immediate visual effect. What I have never done before, is to trigger the lifecycle events programmatically, with minimal visual disturbance. – Alex Cohn Nov 10 '19 at 05:53

1 Answers1

0

Finally, the fix was to send UIDeviceOrientationDidChangeNotification to default NSNotificationCenter. It happens so that the Xamarin plugin was expecting this notification to adjust its window geometry correctly, but it started too late, and didn't receive the notification that the system sent on app launch.

Alex Cohn
  • 56,089
  • 9
  • 113
  • 307