剑网2灵气表,正午的死神,祁锦泓
ios uiswitch 设置默认为开,添加事件:ios uiswitch如何设置默认为开,添加事件呢?希望下面的文章对大家有所帮助。#import"viewcontroller.h" @interfaceviewcontroller() @end @implementationviewcontroller - (void)viewdidload { [superviewdidload]; uiswitch* swt = [[uiswitchalloc]initwithframe:cgrectmake(100,100,100,100)]; [self.viewaddsubview:swt]; [swtseton:yes];//默认是no关着 swt.thumbtintcolor= [uicolorpurplecolor]; [swtaddtarget:selfaction:@selector(tell)forcontrolevents:uicontroleventtouchupinside]; } - (void)didreceivememorywarning { [superdidreceivememorywarning]; // dispose of any resources that can be recreated. } - (void) ftaction{ nslog(@"hhh"); } ui控件 uiswitch 设置默认为开,添加事件 - (void)open:(uiswitch*)swt{ if(swt.on) {ui控件 uiswitch 设置默认为开,添加事件 nslog(@"打开状态"); }else{ui控件 uiswitch 设置默认为开,添加事件 nslog(@"关闭状态"); }ui控件 uiswitch 设置默认为开,添加事件ui控件 uiswitch 设置默认为开,添加事件 } ui控件 uiswitch 设置默认为开,添加事件 - (void)tell{ nslog(@"fas"); } @end
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复
iOS 使用UITextField自定义搜索框 实现用户输入完之后“实时搜索”功能
网友评论