내 uiactions 시트에 Uiswitch를 구현하고 있는데, 내가 원하는 위치에 성공적으로 배치했지만 사용할 방법은 없습니다. 여기 내 코드는 다음과 같습니다.UIACS 시트에있는 UISwitch에서 답변을 얻는 방법
switchButton = [[UISwitch alloc] init];
[mySheet addSubview:switchButton];
[mySheet showInView:self.view];
UILabel *instruction = [[UILabel alloc] init];
[instruction setBackgroundColor:[UIColor clearColor]];
[instruction setText:@"Daily"];
[mySheet addSubview:instruction];
// get the dimension of the sheet to position the switch
CGSize parentSize = mySheet.frame.size;
CGRect rect = switchButton.frame;
rect.origin.x = parentSize.width/2.0 - rect.size.width + 90;
rect.origin.y = parentSize.height - rect.size.height + 90 ;
switchButton.frame = rect;
//get the dimension of the sheet to possition the label
rect.origin.x = parentSize.width/2.0 - rect.size.width -20;
rect.origin.y = parentSize.height - rect.size.height + 90 ;
instruction.frame = rect;
스위치 버튼을 iboutlet으로 초기화했습니다. 액션 시트의 기능에서 나는 이것을하려고합니다. 그것을 위해 - "(IBAction를) (SECURITY) 기능을 비활성화를"하지만 난 이런 짓을 할 때 내가 함께이 링크 가져올 수 없습니다
-(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex: (NSInteger)buttonIndex{
switch (buttonIndex) {
case 0:
{
NSLog(@"Yes Button is working");
}
break;
case 1:
{
if(switchButton.on){
NSLog(@"IS on ?");
}
else {
NSLog(@"Is off?");
}
}
default:
break;
}
** IMP 나는 또한 내가 만든 한 가지 더에 시도했습니다 내 스위치 **
스위치를 사용할 수 없거나 스위치를 사용할 수 없거나 올바른 값을 읽을 수 없다는 뜻입니까? – M0rph3v5
iam이 switch 문을 통해 catch하려고 할 때 실제로 Uiactionsheet에 코드가 표시되면 실제로 읽지 않습니다. S –