Skip to content
This repository has been archived by the owner on Jun 11, 2022. It is now read-only.

"Static" tabbed pager + extra customization #21

Merged
merged 4 commits into from
Dec 5, 2017

Conversation

BitKaitsu
Copy link
Contributor

@BitKaitsu BitKaitsu commented Dec 4, 2017

I have an app where I wanted to use the tabbed pager as an unscrollable version that had tabs of equal width that filled the view. However, that was not possible and I did not want to break the visual style of the app as I was using this tabbed pager elsewhere in the app. The alternatives for Xamarin.iOS didn't seem good enough.

As a result, I added the option to make the tabbed pager static as in the tab bar cannot be scrolled and the tabs are made to fit inside the view and fill it. Naturally, this limits the amount of tabs one can have with the static version but not using too many tabs is up to the user. If the text does fit inside the tab, it is truncated and the user can choose to decrease the font size.

I also made it possible to change the spacing between the tabs and to add padding to the tabs as I wanted to have some extra customization options instead of simply setting the spacing for the static version to zero.

I think this is what people in #6 also wanted.

If enabled:
-Makes the TitleScrollView unscrollable
-Fits the tabs to the view, i.e., tab sizes will be equal
@Cheesebaron
Copy link
Owner

Cheesebaron commented Dec 4, 2017

Hey @BitKaitsu thank you for your Pull Request, will have a look at it asap. I have skimmed the commits and it seems OK to me. Give me some time to try it on a device and see how it works.

Don't worry about the build error, it is not your fault.

@BitKaitsu
Copy link
Contributor Author

BitKaitsu commented Dec 4, 2017

I tested this myself using the sample. I commented out all but 3 view controllers, added TabSpacing = 5; and StaticTabBar = true; to ViewDidLoad(), and changed GetViewControllerIcon to return null. It works fine with the icons as well, but with the font sizes in the sample there wasn't much space for the icons.

@Cheesebaron
Copy link
Owner

Would it be an idea to provide some way of scaling the font automatically to what fits on the screen? Or provide a way to truncate the strings?

@BitKaitsu
Copy link
Contributor Author

BitKaitsu commented Dec 5, 2017

The strings truncate and show the ellipsis, if they don't fit inside the button. As for the automatically scaling font, I personally did not find it necessary as you can change the font size manually to make the text fit.

It's definitely possible to also have the font scale automatically, but it would likely result in the font size changing when rotating the device.

@Cheesebaron
Copy link
Owner

Looks good to me. Will merge when the build has finished

@Cheesebaron Cheesebaron merged commit cdba33e into Cheesebaron:master Dec 5, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants