Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

possible to disable one of the segment? #34

Open
kohdesmond opened this issue May 19, 2017 · 3 comments
Open

possible to disable one of the segment? #34

kohdesmond opened this issue May 19, 2017 · 3 comments

Comments

@kohdesmond
Copy link

Hi as above!

possible to disable part of the segment?

like this ? self.segmentedControl.setEnabled(false, forSegmentAt: 0);

@xaviermerino
Copy link
Owner

What do you mean? I would love to implement what you needed.

@kohdesmond
Copy link
Author

@xaviermerino sorry that I missed your reply.

I was thinking if is possible to provide n no of segments but disable user to go to that index.

for example, I have two segments, BUY & SELL. if I cannot BUY, the BUY segment should be disabled.

Similar to what the default does.
https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/SegmentedControl/Articles/SegmentedControlCode.html

you can enable and disable individual segments within the control using setEnabled:forSegment:. Doing so may be useful to restrict the user to make selections that are valid for the current environment, as illustrated below.

@xaviermerino
Copy link
Owner

xaviermerino commented Jul 10, 2017

Although it is not possible to disable a segment through the currently exposed functions, you could disable a segment when the segments are drawn. And enable it by triggering an update. To do this you must make some changes in the source code but it would be a great addition to the project. It shouldn't be too hard/time-consuming to implement. I would place it in the update() function.

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

No branches or pull requests

2 participants