uiswitch를 추가했으며이를 제스처를 통해 다른 위치로 옮기고 싶습니다. 하지만 uiswitch에 uipangesture 작동하지 않습니다 .. 아래 내가 UIPanGestureRecognizer
가 작동하지 않습니다 생각UipanGesture가 Uiswitch에서 작동하지 않습니다.
UISwitch *swich = [[UISwitch alloc]initWithFrame:CGRectMake(20, 20, 40, 50)];
swich.userInteractionEnabled = YES;
UIPanGestureRecognizer *gesture = [[UIPanGestureRecognizer alloc]
initWithTarget:self
action:@selector(switchdraged:)];
[swich addGestureRecognizer:gesture];
[self.view addSubview:swich];
라고하지 않을 switchdraged 기능 .. 아래
가 switchdraged 기능 내 코드- (void)switchdraged:(UIPanGestureRecognizer *) gesture1
{
UISwitch *swich = (UISwitch *)gesture1.view;
CGPoint translation = [gesture1 translationInView:swich];
swich.center = CGPointMake(swich.center.x + translation.x,
swich.center.y + translation.y);
// reset translation
[gesture1 setTranslation:CGPointZero inView:swich];
}
우리는 d labelDragged의 정의 :? –
정의를 추가하십시오. – KsK
개인적으로 이걸 사용하지 않아도됩니다 ..하지만 여기를 볼 수는 있습니다. http://stackoverflow.com/a/6687064/919545이 도움이 되길 바란다면 –