如何设置UISegmentedControl的默认状态? [英] How can I set the default state of a UISegmentedControl?

查看:180
本文介绍了如何设置UISegmentedControl的默认状态?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在Interface Builder中的UISegmentedControl中设置开始的选定段,还是必须在代码中执行?如果在代码中,则viewDidLoad是设置它的最佳位置吗?

Is there a way to set the starting selected segment in a UISegmentedControl in Interface Builder, or do I have to do it in the code? If it's in the code, is viewDidLoad the best place to set it?

推荐答案

在Interface Builder中,当您在自己的菜单上选择UISegmentedControl对象时UI,然后在属性窗格中的细分控件中,有细分下拉菜单,选择要选择的细分(0,1,依此类推),然后在其下面的 selected选项上打钩。

In Interface Builder when you select UISegmentedControl object on your UI, then in attributes pane, in segment control there's segment drop down menu, select segment that you want selected (0,1 and so on) and tick the 'selected' option below it.

这篇关于如何设置UISegmentedControl的默认状态?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆