BinaryTie
BinaryTie

Reputation: 301

Xamarin forms iOS, How to customize navigation bar?

I am working with one project where we already customized actionbar for android in such a way:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="fill_parent"
    android:paddingRight="5dp"
    android:paddingTop="5dip"
    android:paddingBottom="5dip">
    <ImageView
        android:id="@+id/ImgSmallC"
        android:layout_width="wrap_content"
        android:layout_height="fill_parent"
        android:src="@drawable/smallC"
        android:background="@drawable/back"
        android:paddingRight="10dip"
        android:paddingLeft="10dip"
        android:layout_marginRight="25dp" />
    <FrameLayout
        android:id="@+id/LayoutProvider"
        android:layout_width="wrap_content"
        android:layout_height="fill_parent"
        android:layout_toRightOf="@id/ImgSmallC">
        <TextView
            android:id="@+id/txtProvider"
            android:layout_width="wrap_content"
            android:layout_height="fill_parent"
            android:textSize="20dip"
            android:textColor="#c6c6c6"
            android:paddingRight="35dip"
            android:paddingLeft="10dip"
            android:background="@drawable/back"
            android:text="Test"
            android:layout_gravity="right"
            android:gravity="center_vertical" />
        <ImageView
            android:id="@+id/imgArrow"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="@drawable/dropdown"
            android:layout_marginRight="5dp"
            android:layout_gravity="center_vertical|right" />
    </FrameLayout>
</RelativeLayout>

Here is defined image which is in the center and text which is merged with image , so they both looks like button. Also I implemented some logic in C# code, where we used this .axml file as a layout:

LayoutInflater inflater = (LayoutInflater)ActionBar.ThemedContext.GetSystemService(LayoutInflaterService);
View customActionBarView = inflater.Inflate(Resource.Layout.actionbar_custom_view_done, null);  

How can I to do same with iOS project? As I understand iOS doesn't have .axml files , because they are specific android file. I tried to find documentation examples , how to write custom layout for iOS navigation bar, but unfortunately I didn't found anything. And I want to use that iOS layout same as I mentioned in C# code logic for android.

Upvotes: 0

Views: 1502

Answers (1)

Prashant Cholachagudda
Prashant Cholachagudda

Reputation: 13092

UINavigationController aka Navigation allows very little customisation in iOS

You can find the detailed documentation our website here: https://developer.xamarin.com/recipes/ios/content_controls/navigation_controller/

Upvotes: 1

Related Questions