Using the Interface Builder is extremely easy, but I personally prefer to have styling in code, and when it comes to changing the separator color, it is even easier to use code compared to using the Interface Builder. I have selected System Purple Color, when I build and run my app, it looks like this: Change UITableView separator color with Swift This will allow you to pick a color from the list provided, or select a custom color from the bottom of the list. If you click on the drop down, you will see the following: Under Separator you will see a drop down like as seen in the image below: Now that we have selected the UITableView, we need to go to the Attribute Inspector. Once storyboard/xib file is open, select the UITableView that you want to change the separator color for. To change the separator color using Interface Builder we need to open the storyboard/xib file. ![]() Change separator color with Swift(my preferred method)Ĭhange UITableView separator color with Interface Builderīefore we get into using Interface Builder, this is what the app currently looks like:.In your didSelectRowAtIndexPath delegate method, you would set the text color and accessory type for the selected cell, then deselect the cell. Change separator color with Interface Builder When a checked cell is selected, the font color and accessory type are changed back and the selection fades out.There are two ways to do this, both are very easy, but there is one that I personally prefer to use. ![]() In this quick tutorial I will show you how to change a UITableView's separator color.
0 Comments
Leave a Reply. |