Я пытаюсь повернуть пользовательский вид, добавленный к главному виду. Я попытался добавить распознаватель жестов к главному виду и подвид. Вот мой кодMy UIRotationGestureRecgonizer обработчик обратного вызова не получает вызов в iOS
- (void)viewDidLoad
{
[super viewDidLoad];
UIView *demoView = [[UIView alloc]initWithFrame:CGRectMake(100, 100, 100, 100)];
UIRotationGestureRecognizer *rg= [[UIRotationGestureRecognizer alloc]initWithTarget:self action:@selector(handleTap:)];
[rg setDelegate:self];
self.view.userInteractionEnabled = YES;
demoView.userInteractionEnabled = YES;
[demoView addGestureRecognizer:rg];
[self.view addGestureRecognizer:rg];
demoView.backgroundColor = [UIColor orangeColor];
[self.view addSubview:demoView];
}
-(IBAction)handleTap:(UIRotationGestureRecognizer *)recognizer
{
//NSLog(@"HERE");
recognizer.view.transform = CGAffineTransformMakeRotation([recognizer rotation]);
recognizer.rotation = 0;
//NSLog(@"AND HERE");
}
Спасибо, я понял проблему – TryinHard
@KPTryin - рад, что я мог вам помочь. – katzenhut