Giter Site home page Giter Site logo

tapptitude / ttsegmentedcontrol Goto Github PK

View Code? Open in Web Editor NEW
586.0 18.0 93.0 6.25 MB

An elegant, animated and customizable segmented control for iOS created by Tapptitude

Home Page: https://tapptitude.com

License: MIT License

Swift 99.19% Ruby 0.46% Objective-C 0.35%
swift swift3 cocoapods segmented-controls ui uicomponent uikit ios xcode interface-builder

ttsegmentedcontrol's People

Contributors

alextud avatar brightsider avatar cocanlucian avatar daria-andrioaie avatar efraimb avatar

Stargazers

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

Watchers

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

ttsegmentedcontrol's Issues

0.4.7 is the only version available

Hi,
I'm trying to install version 0.4.9 and the only version that gets installed is 0.4.7.
I have this in the podfile. pod 'TTSegmentedControl', '~> 0.4' and it loads version 0.4.7

If I use pod 'TTSegmentedControl', '~> 0.4.9' it says it doesn't exist.

So I tried loading it manually by dragging the TTSegmentedControl.swift file into a brand new project. When I create a new TTSegmentedControl, as son as I set the custom class I get the failed to render error. I downloaded the TTSegmentedControl-0.4.9.zip file to get the latest TTSegmentedControl.swift file. Am I not understanding something?

Landscape Support

When the orientation changes to landscape,

  1. the control doesn't resize to accommodate the new screen size.
  2. If an option is selected, the slider moves to an awkward position in the uppermost left point of the view. The block in didSelectItemWith doesn't execute and further selection is no longer possible in this orientation.
  3. When switched back to portrait, the slider stays in the top left corner, but functionality is repaired. If another selection is made, the slider will correct its position to highlight the selection and the didSelectItemWith block executes correctly.
  • I've noticed this issue in several locations of my implementation on both iPads and iPhones.
  • I've tested this on iOS10.x.x

selectItemAt does not move the thumb

.selectItemAt(index: 0, animated: true) does not make the thumb move when you try to set the position programmatically. is there another way?? thank you

Zero Indexed

Great component, may I suggest though you make the first item in the segment 0 indexed rather than 1. Every first anything in Swift is always 0 and not 1 ...

keep up the good work... cheers

Change itemTitle

Hi,
first of all thanks for your TTSegmentedControl, it is very useful.

My question is:
How can i change the itemTitle after having already definite it?
I tried with a simple new definition but it doesn't works.

Thank you

'segmentControl.noItemSelected = true' not working

Following is my code -

let segmentControl = TTSegmentedControl(frame: CGRect(x: (contentView.frame.size.width - timeView.frame.size.width) / 2, y: y, width: timeView.frame.size.width, height: segment_control_height))
segmentControl.tag = am_pm_segment_control_tag
segmentControl.allowChangeThumbWidth = false
segmentControl.noItemSelected = true
segmentControl.didSelectItemWith = { (index, title) -> () in
self.segmentCurrentIndex = index
}
segmentControl.defaultTextColor = .blackColor2
segmentControl.defaultTextFont = UIFont.openSansSemiboldFontOfSize(MAConstants.regularFontSize)
segmentControl.selectedTextColor = .whiteColor
segmentControl.selectedTextFont = UIFont.openSansSemiboldFontOfSize(MAConstants.regularFontSize)
segmentControl.useShadow = true
segmentControl.useGradient = false
segmentControl.thumbColor = .greenColor3
segmentControl.cornerRadius = MAConstants.componentCornerRadius
segmentControl.itemTitles = segment_items
contentView.addSubview(segmentControl)

changing UIViewControllers

when first item is selected first UIViewController has to display and when second item is selected second UIViewController has to display

Update to swift 5.0

I want to use this awesome library in my project.
However my project is in swift 5 so are there any plans to convert it to swift 5 anytime soon?

Thanks

Black Drag Error

screen shot 2019-03-07 at 11 59 02 pm

Hello. I am getting an UI error when I transition to another view Controller then back to the View Controller that has the Segment Control. Any idea on how to fix this? I submitted a picture of the error occurring.

Segmented is not supporting RTL when using constraints?

I've added the segmented by code, and added constraints, but when the app is rtl, the segmented remains the same. Not mirroring the view to support rtl.

Try to use a little hack to mirror the view using CGAffineTransform, but the labels are mirrored also. Not very good idea.

Any idea?

set image

Can we set image instead of itemTitles ?

Detecting when an item has been selected

Trying to make use of your library, the customisation is good but it is not documented at all on how to make practical use of the segmented control. It worked completely different to the standard segmented control that comes by default. Tried to use the variable didSelectItemWith, but can't get it to work. Any example you could provide would help.

Example is not working

You changed the URL with the forked one. There are new updates in this repo, but not in the forked repo. Why did you change the URL path?

Unable to set the initial index.

Trying to set an initial selected index via selectItemAt(index: 3). This is not working as expected. When I step through the code and it always states it is not configured.

I have the controls setup in InterfaceBuilder.

Unable to fit size when device is iPhone SE

Hello there,

I'm facing an issue when I used your library with an iPhone SE. I used 3 items and the last item is not display well.

I join a screenshot to help you understand my issue.

capture d ecran 2019-01-23 a 11 43 57

Thank you.

Failed to render layout, and crash at runtime.

Hi there,

I'm experiencing several problems, the first is that it fails to render the layout:
ss

I'm able to run it despite the error above. I try to use it in my controller like this, everything seems fine:

ssss

But runtime I get this error:

sss

Sometimes I even get a different error:

sssss

Furthermore my entire controller, where I use it, it black, since it cannot be rendered.

CocoaPods version update

Thanks for your library, it makes development easier :)

But I have a small issue with your library. When I had updated swift version on my main project to 4, I've got 2 errors occurred into Xcode.
It refers to NSAttributedStringKey keys, such as foregroundColor and font.

I saw in your last commits that you fixed that sometimes ago and also pushed a new version of your library. But despite that, you don't push your up-to-date version into the cocoapods repo.

Please, update your library to give a possibility use up-to-date version just writing pod 'TTSegmentedControl'.

Regards.

Calling "self.view.layoutIfNeeded()" breaks control

In the viewDidLoad() function of the View Controller, I call self.view.layoutIfNeeded(), When I wasn't calling this, the control was working fine but now it completely breaks the control's settings including the titles, drag settings etc, I am running the latest version of the pod file.

index out of range on actual device

hi I configured it on my simulator and it run perfectly but first attempt to run on physical device I get index out of range on the line I commented where Is the problem on this function I see that index variable is -1 I didn't even call this function.

public func selectItemAt(index: Int, animated: Bool = false) { if !isConfigurated { currentSelectedIndex = index return } let label = allItemLabels[min(index, attributedDefaultTitles.count)] //////on this line/////// selectedLabelsView.isHidden = noItemSelected changeThumbFrameForPoint(label.center, animated: animated) }

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.