Forum Xamarin.iOS

Announcement:

The Xamarin Forums have officially moved to the new Microsoft Q&A experience. Microsoft Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

To create new threads and ask questions head over to Microsoft Q&A for .NET and get involved today.

How does Appearance Proxy Work with UINavigationBar.AppearanceWhenContainedIn

bitsnbytesbitsnbytes Member ✭✭

Please see the custom navigation bar example here: https://github.com/xamarin/ios-samples/tree/main/NavigationBar/NavigationBar

Specifically: CustomBackButtonNavController.cs and CustomBackButtonViewController.

In the notes of CustomBackButtonNavController.cs they say, "UINavigationController subclass used for targeting appearance proxy changes in the Custom Back Button example."

Yet that class is NEVER utilized other than line 28 in CustomBackButtonViewController. And in the way it is used I don't see how CustomBackButtonNavController is ever instantiated to accurately differentiate as an instance to target.

Can someone please explain why they set up the custom back button in this way and how the appearance proxy is intended to work in this example?

Thanks.

Best Answer

  • ColeXColeX Member, Xamarin Team Xamurai
    edited January 11 Accepted Answer

    CustomBackButtonNavController is used in Storyboard .

      <navigationController id="loH-V1-Ube" customClass="CustomBackButtonNavController" sceneMemberID="viewController">
                        <navigationBar key="navigationBar" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" id="2pW-bN-giW">
                            <rect key="frame" x="0.0" y="20" width="375" height="44"/>
                            <autoresizingMask key="autoresizingMask"/>
                        </navigationBar>
                        <connections>
                            <segue destination="hPJ-VP-dpS" kind="relationship" relationship="rootViewController" id="cL3-mM-SEv"/>
                        </connections>
                    </navigationController>
    

    check https://github.com/xamarin/ios-samples/blob/main/NavigationBar/NavigationBar/Main.storyboard#L447 .


    Xamarin forums are migrating to a new home on Microsoft Q&A!
    We invite you to post new questions in the Xamarin forums’ new home on Microsoft Q&A!
    For more information, please refer to this sticky post.

Answers

  • ColeXColeX Member, Xamarin Team Xamurai
    edited January 11 Accepted Answer

    CustomBackButtonNavController is used in Storyboard .

      <navigationController id="loH-V1-Ube" customClass="CustomBackButtonNavController" sceneMemberID="viewController">
                        <navigationBar key="navigationBar" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" id="2pW-bN-giW">
                            <rect key="frame" x="0.0" y="20" width="375" height="44"/>
                            <autoresizingMask key="autoresizingMask"/>
                        </navigationBar>
                        <connections>
                            <segue destination="hPJ-VP-dpS" kind="relationship" relationship="rootViewController" id="cL3-mM-SEv"/>
                        </connections>
                    </navigationController>
    

    check https://github.com/xamarin/ios-samples/blob/main/NavigationBar/NavigationBar/Main.storyboard#L447 .


    Xamarin forums are migrating to a new home on Microsoft Q&A!
    We invite you to post new questions in the Xamarin forums’ new home on Microsoft Q&A!
    For more information, please refer to this sticky post.

Sign In or Register to comment.