Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在静态表中有一个 uiswitch 视图。我试图通过 viewdid 加载方法中的标签来检索它。由于某种原因,它总是显示为空。我用 viewWithTagMethod 来做。
UISwitch* switch = (UISwitch*)[self.view viewWithTag:tag]; [switch setOn:[value boolValue] animated:YES];
静态表视图内容直到viewWillAppear:animated:调用了 super 实现后才会加载。将您的代码移到稍后的位置,您应该没问题。或者,只需使用插座。
viewWillAppear:animated: