tapptitude / ttsegmentedcontrol Goto Github PK
View Code? Open in Web Editor NEWAn elegant, animated and customizable segmented control for iOS created by Tapptitude
Home Page: https://tapptitude.com
License: MIT License
An elegant, animated and customizable segmented control for iOS created by Tapptitude
Home Page: https://tapptitude.com
License: MIT License
How do I detect when an item is selected?
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?
When the orientation changes to landscape,
.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
Unable to tap control when inside a scrollable view
I'm trying to update the index title, but when I do, the constraints gets broken. Index 1 moves outside the container.
i want to present some view controller
what should i do ?
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
I want to disable to space between the border of the segment control and the items themselves. Can I?
Tried padding=0, didn't work.
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
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)
Hi, Thanks for you're library. I got a frame problem for the middle item that the frame isnt like others like the picture.
when first item is selected first UIViewController has to display and when second item is selected second UIViewController has to display
Any one can suggest how to change font type in this?
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
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?
Can we set image instead of itemTitles ?
Any chance you can update this to Swift 4.2?
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.
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?
I'm using selectItemAt(index: someNumber, animated: false)
and it´s animating anyway. Thanks!
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.
Hi there,
I'm experiencing several problems, the first is that it fails to render the layout:
I'm able to run it despite the error above. I try to use it in my controller like this, everything seems fine:
But runtime I get this error:
Sometimes I even get a different error:
Furthermore my entire controller, where I use it, it black, since it cannot be rendered.
Hello,
Is there a way to change the defaultTextColor from outside the initial control creation code? Like from a button tap event.
Thank you
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.
There doesn't seem to be any method to set the current index, however there is a method to get the current method.
as title , thank you
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.
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) }
Please share a way to set only 2 variables in the segment control
I spent a lot of time trying to figure this out and any help/hint would be appreciated.
I need to remove the selected view border/offset. (I want the selected view height to be equal with containerView height)
Screenshot
Is it possible to programmatically change the selection thumb offset depending on e.g. a scroll offset of a associated scrollview? I would like to slide from one segment to another smoothly as I scroll.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.