Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 58056

How to change the color of TableView table Section on iOS ?

$
0
0

I am trying to change the color of Table section on tableView. I was able to successfully change the color on Android.

I used GetRenderer on android to override the tablesection.

    protected override Xamarin.Forms.Platform.Android.TableViewModelRenderer GetModelRenderer(Android.Widget.ListView listView,     
                                                                                        Xamarin.Forms.TableView view)
    {
        return new CustomTableViewModelRenderer(Context, listView, view);
    }

Is there a similar method on iOS ? I am trying to set ModelRender for tableView. How do I call the below renderer from IOS ?

public class CustomTableViewModelRenderer : TableViewModelRenderer
{
public CustomTableViewModelRenderer(TableView model)
: base(model)
{
}

        public override UIView GetViewForHeader (UITableView tableView, nint section)
        {
            UILabel headerLabel = new UILabel(); // Set the frame size you need
                headerLabel.TextColor = UIKit.UIColor.FromRGB(1, 83, 157);
            return headerLabel;
        }
}

Viewing all articles
Browse latest Browse all 58056

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>