dotnet-ad / PagerViewController

Tabs at the top of the screen for Xamarin.iOS.
MIT License
14 stars 5 forks source link
ios tabs xamarin

PagerViewController

A basic pager ViewController for Xamarin.iOS.

Documentation/PagerAnimation.gif

Install

Available on NuGet

NuGet

Getting started

var colors = new[]
{
    UIColor.FromRGB(76,217,100),
    UIColor.FromRGB(52,170,220),
    UIColor.FromRGB(88,86,214),
    UIColor.FromRGB(255,45,85),
};

var pages = new[]
{
    new UIViewController() { Title = "First" },
    new UIViewController() { Title = "Second" },
    new UIViewController() { Title = "Third" },
    new UIViewController() { Title = "Last" },
};

var style = new PagerStyle()
{
    SelectedStripColors = colors,
};

var pager = new PagerViewController(style, pages);

var nav = new UINavigationController(pager);
nav.NavigationBar.Translucent = false;

Styling

Predefined styles

You can pickup one of the predefined styles.

PagerStyle.Default

Documentation/PagerAnimation.gif

PagerStyle.NotAnimated

Documentation/PagerAnimation.gif

PagerStyle.Stretched

Documentation/PagerAnimation.gif

PagerStyle.Rounded

Documentation/PagerAnimation.gif

PagerStyle.RoundedNotAnimated

Documentation/PagerAnimation.gif

PagerStyle.RoundedStretched

Documentation/PagerAnimation.gif

PagerStyle.Dot

Documentation/PagerAnimation.gif

PagerStyle.DotAnimated

Documentation/PagerAnimation.gif

PagerStyle.DotStretched

Documentation/PagerAnimation.gif

Custom

You can customize appearance of your tabs with the properties of a PagerStyle instance.

Strip style

StripStyle.None (default)

Documentation/PagerAnimation.gif

StripStyle.Rounded

Documentation/PagerAnimation.gif

StripStyle.Dot

Documentation/PagerAnimation.gif

Strip animation

StripAnimation.Constant (default)

Documentation/PagerAnimation.gif

StripAnimation.Stretched

Documentation/PagerAnimation.gif

StripAnimation.None

Documentation/PagerAnimation.gif

Roadmap / Ideas

About

This view controller did the trick but is far from a real polished software and needs some work for real customization. Meanwhile, it can save some time to someone, maybe ... And I'll not lost it!

Contributions

Contributions are welcome! If you find a bug please report it and if you want a feature please report it.

If you want to contribute code please file an issue and create a branch off of the current dev branch and file a pull request.

License

MIT © Aloïs Deniel