UISwitch的用法

//公開手機號的開關
    UISwitch * phoneSwitch = [[UISwitch alloc] initWithFrame:CGRectMake(bgimage.width-95, (50.0f-30.0f)/2+1, 50, 30)];
    phoneSwitch.on = YES;
    [phoneSwitch addTarget:self action:@selector(switchIsChange:) forControlEvents:UIControlEventValueChanged];
    [bgimage addSubview:phoneSwitch];
    [phoneSwitch release];
//UISwitch繼承自UIControl,能夠經過UISwitch的ison方法,來判斷它是不是選中的。
相關文章
相關標籤/搜索