Skip to content

christianhelle/ScrollableSegmentedControl

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
src
 
 
 
 
 
 
 
 

Build Status NuGet NuGet buymeacoffee

ScrollableSegmentedControl

A drop-in replacement for UISegmentedControl mimicking the style of the segmented control used in Google Currents and various other Google products.

A C# port for Xamarin.iOS of HMSegmentedControl written by Hesham Abd-Elmegid (https://github.com/HeshamMegid/HMSegmentedControl).

Screenshot

ScrollableSegmentedControl

Usages

The easiest way to get started with using this is by installing the ScrollableSegmentedControl NuGet package to your Xamarin.iOS project

Here's an example of how to create the ScrollableSegmentedControl

private void CreateScrollableSegmentedControl()
{
    var sectionTitles = new[] { "One", "Two", "Three", "Four", "Five", "Six" };
    var segmentedControl = new ScrollableSegmentedControl(sectionTitles)
    {
        Font = UIFont.FromName("STHeitiSC-Light", 18.0f),
        Frame = new CGRect(0, 60, View.Frame.Width, 40),
        SegmentEdgeInset = new UIEdgeInsets(0, 10, 0, 10),
        SelectionStyle = ScrollableSegmentedControlSelectionStyle.FullWidthStripe,
        SelectionIndicatorLocation = ScrollableSegmentedControlIndicatorLocation.Down
    };
    View.AddSubview(segmentedControl);
}

Selection Indicator Position

enum ScrollableSegmentedControlIndicatorLocation
{
    Up,
    Down,
    None
}

Selection Style

enum ScrollableSegmentedControlSelectionStyle
{
    TextWidthStripe,
    FullWidthStripe,
    Box,
    Arrow
}

Segment Width Styles

enum ScrollableSegmentedControlWidthStyle
{
    Fixed,
    Dynamic
}

For tips and tricks on software development, check out my blog

If you find this useful and feel a bit generous then feel free to buy me a coffee :)

About

A drop-in replacement for UISegmentedControl mimicking the style of the segmented control used in Google Currents and various other Google products.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages