I would also add 'segmentedControl.selectedSegmentIndex = 0' in the setup function so that it defaults to selecting the first item and let's the user know what is selected when the app starts
Nicely explained - as usual. Thanks for sharing! Also as usual, I have a suggestion, a question and a comment! The suggestion - in the videos you do that show both the storyboard and programmatic ways of doing something, it would be nice if the video description contained the time stamp of where the programmatic example starts. Some people have vowed never to use storyboards and would prefer to just watch the programmatic instructions (and vice versa I imagine). The question - I’m a “no storyboard” developer, and in today’s programmatic example, when you added the target, you left the brackets on the name of the function in the #selector() clause. Why? I didn’t even know that was possible. All of my targets just contain the function name with no brackets or parameters. What can I put inside those brackets? Can I pass arbitrary parameters (if the function is coded to accept them)? I thought when adding a target like that, I was limited to only (and automatically) having the sender passed...? My @objc functions also always accept “sender” as a parameter. I never thought about using the “_” so that I could use a parameter name more descriptive than “sender”. Okay - and my comment - for some of my segmented controls, I found it “better” to build my switch statement based on the “title” for the selectedSegmentIndex rather than the index value itself. It made my code easier to read and therefore to maintain. (Even if the title ends up changing, a simple search would show all the places that need updating). To use title instead of index, I just add: let title = sender.titleForSegment(at: sender.selectedSegmentIndex) at the top of the function and then switch based on the title value. It makes it easy to see what each case: statement is responding to and saves having to search through the code to find out what 0, 1, 2 and 3 are actually displaying. (This is more a tip for other readers than it is for you Sean - and I’m sure it’s not “always” better to do it this way - but it sure seems to be better for my use cases!) Thanks again Sean! Stay safe!
Hi Sean! Can you please share the image assets you used for this tutorial? I’d like to code along when I rewatch the video. Thanks a lot for all you do.
hola necesito utilizar un segment control pero con mas elementos, necesito que se desplace el componente de forma horizontal, ejemplo los titulares en google news
Hey Sean, love your videos - super helpful! If I wanted to stick with text in the Segmented Control and wanted to customize the text color, is there a way to do that? It doesn't look like there is a text color setting in the Attributes Inspector.
Hi quick question. Can i change font sizes for each segment? I know i can change for all, but i want each segment to have different font size. Is it possible?
Hey Sean Allen hope you are doing good. Regarding UISegmentControl I am unable to apply gradient colors to selectedSegmentTintColor property can u pls tell me how to apply gradient colors on this.
Watch Next - iOS Dev Launchpad - ua-cam.com/video/poQZDVKOZOE/v-deo.html
Sean, your explanation on this subject is extremely helpful, thank you very much!
Thank Sean! this is what i am looking. Doing segmented controller both tru Storyboard and programmatic.
Glad it was helpful!
Thanks a lot my friend for your job. You are doing really good stuff. I love it. Respect from CZ.
Glad you liked it!
Great explanation, it clicked for me :) , thanks Sean you are great.
I like the arrow Overlays. Good vid
Me too. Really helps point things out.
I would also add 'segmentedControl.selectedSegmentIndex = 0' in the setup function so that it defaults to selecting the first item and let's the user know what is selected when the app starts
Hi Sean . Can you make a video how to add badge counter to UIButton and/or UIImageView ?
The counter could be Int , or string .
Hey @sean I bought your course from Teachable , where is the Slack Channel ? I cant see.
The link for the Slack Channel will show up when the first batch of videos releases in the next day or two.
Sean Allen Sean is incredible developer and teacher 👨🏫. Love to watch his tutorial.
Hi Sean, how to change the tint color of segmented control and also the Height?
Nicely explained - as usual. Thanks for sharing!
Also as usual, I have a suggestion, a question and a comment!
The suggestion - in the videos you do that show both the storyboard and programmatic ways of doing something, it would be nice if the video description contained the time stamp of where the programmatic example starts. Some people have vowed never to use storyboards and would prefer to just watch the programmatic instructions (and vice versa I imagine).
The question - I’m a “no storyboard” developer, and in today’s programmatic example, when you added the target, you left the brackets on the name of the function in the #selector() clause. Why? I didn’t even know that was possible. All of my targets just contain the function name with no brackets or parameters. What can I put inside those brackets? Can I pass arbitrary parameters (if the function is coded to accept them)? I thought when adding a target like that, I was limited to only (and automatically) having the sender passed...? My @objc functions also always accept “sender” as a parameter. I never thought about using the “_” so that I could use a parameter name more descriptive than “sender”.
Okay - and my comment - for some of my segmented controls, I found it “better” to build my switch statement based on the “title” for the selectedSegmentIndex rather than the index value itself. It made my code easier to read and therefore to maintain. (Even if the title ends up changing, a simple search would show all the places that need updating). To use title instead of index, I just add:
let title = sender.titleForSegment(at: sender.selectedSegmentIndex)
at the top of the function and then switch based on the title value. It makes it easy to see what each case: statement is responding to and saves having to search through the code to find out what 0, 1, 2 and 3 are actually displaying. (This is more a tip for other readers than it is for you Sean - and I’m sure it’s not “always” better to do it this way - but it sure seems to be better for my use cases!)
Thanks again Sean! Stay safe!
really good video bro!! are these videos apart of your new course?
Thanks Kenroy. Nope, this one is a separate video all on its own.
Hi Sean! Can you please share the image assets you used for this tutorial? I’d like to code along when I rewatch the video. Thanks a lot for all you do.
This is where I downloaded the assets from. Be careful. Lot of ads on that site. acbl.mybigcommerce.com/52-playing-cards/
Thanks a lot.
hola necesito utilizar un segment control pero con mas elementos, necesito que se desplace el componente de forma horizontal, ejemplo los titulares en google news
Hey Sean, love your videos - super helpful! If I wanted to stick with text in the Segmented Control and wanted to customize the text color, is there a way to do that? It doesn't look like there is a text color setting in the Attributes Inspector.
Yes, off the top of my head, I believe you need to change the "tint color" to change the text color.
How we create a table like a grid in swift4 please help me
Hi quick question. Can i change font sizes for each segment? I know i can change for all, but i want each segment to have different font size. Is it possible?
Hey Sean Allen hope you are doing good. Regarding UISegmentControl I am unable to apply gradient colors to selectedSegmentTintColor property can u pls tell me how to apply gradient colors on this.
Superb video as always. Actually I want to ask a question. Can you please tell me from where you learn the short keys? (Like control+i for Alignment)
I've just picked them up over time. Try googling Xcode keyboard shortcuts. You'll fine a lot of resources.
Dude I love your examples. Apple needs to hire you to help with explain Swift. Their documentation suuuuuucks
This particular topic would be in the UIKit documentation, not Swift. What's wrong with their documentation in either one?
Hello Sean
What is step to change XCode selection color red.
I guess I know what you mean...
Go to Settings -> General & you'll find it there. (It applies to all apps, not just Xcode though)