ios – 如何从UISegmentController中删除边框?

ios – 如何从UISegmentController中删除边框?,第1张

概述我想删除UISegmentController的边框.如果有可能.否则在自定义边框颜色中更改它. 要更改分段控件的颜色和文本,请尝试: Objective-C的: NSArray *array = [segmentedControl subviews];[[array objectAtIndex:2] setTintColor:[UIColor redColor]];[[array obje 我想删除UISegmentController的边框.如果有可能.否则在自定义边框颜色中更改它.

解决方法 要更改分段控件的颜色和文本,请尝试:

Objective-C的:

NSArray *array = [segmentedControl subvIEws];[[array objectAtIndex:2] setTintcolor:[UIcolor redcolor]];[[array objectAtIndex:1] setTintcolor:[UIcolor greencolor]];    [[array objectAtIndex:0] setTintcolor:[UIcolor bluecolor]];

迅速:

let array = segmentedControl.subvIEwsarray[2].tintcolor = UIcolor.redcolor()array[1].tintcolor = UIcolor.greencolor()array[0].tintcolor = UIcolor.bluecolor()

请注意,子视图与用户界面的顺序相反.

您可以以相同的方式自定义边框:

let array = segmentedControl.subvIEwsarray[0].layer.borderWIDth = 5 // change thickness of borderarray[0].layer.cornerRadius = 4 //change corner radius
总结

以上是内存溢出为你收集整理的ios – 如何从UISegmentController中删除边框?全部内容,希望文章能够帮你解决ios – 如何从UISegmentController中删除边框?所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://www.54852.com/web/1107444.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-28
下一篇2022-05-28

发表评论

登录后才能评论

评论列表(0条)

    保存