iOS - 在模态视图控制器上设置UISwitch开/关状态

时间:2012-04-13 01:17:19

标签: ios boolean modalviewcontroller uiswitch

我在从BOOL设置UISwitch的状态时遇到问题。这可能很简单,所以如果有人能提供帮助,我会非常感激。这是我的代码不起作用,但可能会更清楚。

 RoutingController *routingController = [[RoutingController alloc] initWithNibName:@"RoutingController" bundle:nil];

routingController.routingDelegate = self;

if (audioController->oscOneLFObool == YES) {
    routingController.oscOneLFOOneSwitch.on = YES;
} else {
    routingController.oscOneLFOOneSwitch.on = NO;
}


routingController.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;

[self presentModalViewController:routingController animated:YES];

1 个答案:

答案 0 :(得分:1)

RoutingController的视图未加载,因此oscOneLFOOneSwitch为零。

在[self presentModalViewController:routingController animated:YES]

中查看加载