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

Dynamically fill segmented control - problem with Width of element #40

Open
morty9 opened this issue May 10, 2019 · 3 comments
Open

Dynamically fill segmented control - problem with Width of element #40

morty9 opened this issue May 10, 2019 · 3 comments

Comments

@morty9
Copy link

morty9 commented May 10, 2019

Hi,

I would like to fill the segmented control dynamically with my database data.
It's work but i've some issue that i can't figure it out...

I've choose to not have a fix width for all items and unfortunately my items are not to the right size (like you can see on this picture)
Screenshot 2019-05-10 at 14 46 58

But when i add items normally with one .insertSegment by items it's worked fine...

Have you some idea for this ?

I put my code here to let you see
Screenshot 2019-05-10 at 14 56 20

Thanks in advance and thanks for the lib !

PS: sorry for my english (i'm french :D)

@ashkan84f
Copy link

Does this work?

for (index, aTitle) in (titlesArr.enumerated()) {
sgmt.insertSegment(withTitle: aTitle, at: index)
}
sgmt.layoutSubviews()

@keegho
Copy link

keegho commented Dec 7, 2019

Hello..how can i adjust the width and alignment of each item to be full width of the screen if i want to for instance regarding the iPad view i cannot control it. Tried fixed width true or false but no adjusted is there a solution for that.

Screen Shot 2019-12-07 at 5 02 30 PM

@devashiskant
Copy link

How can i set the SegmentControl content to centre if there is only one element

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants