【发布时间】:2011-04-12 15:34:13
【问题描述】:
嗨,我有两个观点
第一个视图包含主要功能,第二个视图用于让用户更改第一个视图的设置。
我在第二个视图中插入了一个开关,让用户更改第一个视图的设置
我有两个问题,如何使用 switch 为一个值设置 YES 和 NO?然后,基于该值 第一种观点会有不同的反应?
附:我用导航方法改变视图,而不是添加子视图
提前致谢
假设我有以下代码
第一个视图.m
- (IBAction) addValue:(id)sender
{
aValue ++;
}
//the following will react according to the setting on second view
If (????//Don't know what to put here to represent the switch is ON or OFF)
{ //whatever action}
else
{//whatever action}
第二个视图.h
@interface
//declaration of the switch
- (IBAction) changeMode:(id)sender
@end
第二个视图.m
-(IBAction) changeMode:(id)sender
{
//What to put here to switch ON and OFF ??
}
【问题讨论】:
标签: cocoa-touch ios button switch-statement