uiswitch怎么设置成默认是关闭的
展开全部
界面实现 UISwitch
a> 控制器.m 文件添加UISwitch属性
1 @interface moboViewController ()
2 @property (nonatomic, strong) UISwitch *mainSwtich;
3 @end
b> - (void)viewDidAppear 实例化 UISwitch 并添加界面
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidLoad];
self.mainSwtich = [[UISwitch alloc]initWithFrame:CGRectMake(100, 100, 0, 0)];//实例化坐标 x100,y100
[self.view addSubview:self.mainSwtich]; //添加界面
}
,
a> 控制器.m 文件添加UISwitch属性
1 @interface moboViewController ()
2 @property (nonatomic, strong) UISwitch *mainSwtich;
3 @end
b> - (void)viewDidAppear 实例化 UISwitch 并添加界面
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidLoad];
self.mainSwtich = [[UISwitch alloc]initWithFrame:CGRectMake(100, 100, 0, 0)];//实例化坐标 x100,y100
[self.view addSubview:self.mainSwtich]; //添加界面
}
,
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询