-
Hello All, I am currently porting an older Xamarin iOS application over to the MAUI 9 platform, and it is my understanding that the custom renderer feature in Xamarin has been deprecated in favour of the new handler approach in MAUI. Presently, this application makes heavy use of Xamarin custom renderers to access key events in the iOS lifecycle:
We attach specific low-level iOS code to these events for the various application screens. These events are readily accessible via Xamarin renders, but this accessibility appears to be missing with MAUI handlers. Nearly all handler documentation is in regard to extending the base MAUI controls for customization - Entry, DatePicker etc - but nothing regarding how to access and override the platform-specific lifecycle events. So my question is two-fold:
The application will be extended to also work for Android v16 in the near future, so I expect we will need a means to access the equivalent underlying lifecycle events for this platform as well. This question may be somewhat related to the following issues: For completeness, I am using Visual Studio Code under MacOS Sequoia 15.5 with the .NET 9 framework and following workflows installed: Installed Workload Id | Manifest Version | Installation Source Any guidance or code samples will be greatly appreciated. Thank you! Cheers, Parmjit V. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
You can either
|
Beta Was this translation helpful? Give feedback.
-
Hello All, It is possible to access the iOS lifecycle events through a MAUI handler. Credit to our friends over at Stack Overflow for the basic guide: Adjusted somewhat for my specific use-case, here is the implementation for a generic MAUI app called "MyMauiApp":
Hopefully this will help out a fellow MAUI traveller. I expect a similar approach can be used to intercept the lifecycle events for Android as well. Happy coding, Parmjit V. |
Beta Was this translation helpful? Give feedback.
Hello All,
It is possible to access the iOS lifecycle events through a MAUI handler. Credit to our friends over at Stack Overflow for the basic guide:
https://stackoverflow.com/questions/72632089/how-to-call-a-method-after-a-view-has-rendered-in-maui-onappearing-fires-too-s
Adjusted somewhat for my specific use-case, here is the implementation for a generic MAUI app called "MyMauiApp":