Giter Club home page Giter Club logo

thsegmentedcontrol's People

Contributors

cromulentlabs avatar pws5068 avatar tayhalla avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

thsegmentedcontrol's Issues

How to deselect and/or select all segments?

I'm using THSegmentedControl inside a tableviewcell. When a button is pressed in another cell, I reload the tableview and want to deselect or select all of the segments. When I try to call setSelectedIndexes with:

[_scheduleCell.segmentedControl setSelectedIndexes:[[NSOrderedSet alloc] initWithArray:@[]]];

nothing happens.

Can't change which segments are selected programatically

Thanks for putting this control together! I've got it working in my project, but I can't figure out how to select certain segments programatically..

With a UISegmentedControl, I can select one segment as follows:

self.segmentedControl.selectedSegmentIndex = someDefaultIndex

I have a control with 7 segments (representing the days of the week), and by default, I want 5 of them to be enabled (representing workdays).

Is this possible with THSegmentedControl?
If not, I'm open to trying to add this support to THSegmentedControl: Any idea which file I'd need to modify to do so?

All the best,
Andrew Ash

THSegmentedControlSegments never added to self.segmentLabels

I realize you haven't touched this code in 5 years, but thought I would log this bug anyway.

In clearExistingSeperatorsAndLabels, you go through the self.segmentLabels to remove them from their superview so that you can create new ones every time the control is re-drawn, but the problem is that the segments are never added to self.segmentLabels, so it's always empty. This results in a new set of segments being added as subviews on every redraw.

Unable to unselect all segments.

Hi,
first of all let me thank you for your good work. =)

Unfortunately I'm not able to unselect all segment graphically. Passing in nil or an empty NSSet does the right job under the hood but does not update the controller visually.

Calling setNeedsDisplay manually does not help either. At the moment I'm removing and re-adding the controller when I need this done.

Thank in advance. โœŒ๏ธ

Crash in [THSegmentedControlSegment commonInit] in iOS < 7

- (void)commonInit
{
    // Init
    self.backgroundColor = [UIColor clearColor];
    self.clipsToBounds = YES;
    self.preSelected = NO;

    // Textfield init
    self.textField = [[THLabel alloc] initWithFrame:self.bounds];
    self.textField.backgroundColor = [UIColor clearColor];
    self.textField.tintColor = self.segmentHighlightedBackgroundColor;
    self.textField.clipsToBounds = YES;
    self.textField.adjustsFontSizeToFitWidth = YES;
    self.textField.textAlignment = NSTextAlignmentCenter;
    [self addSubview:self.textField];
}

tintColor is only available from iOS7 so this crashes iOS6

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.