У меня есть простой проект xcode, созданный только из шаблона "Master-Detail Application", для iPad. Когда устройство находится в портретной ориентации, основной вид скрыт, и когда вы проведите пальцем по экрану прямо на подробном представлении, откроется главное представление. Теперь я хочу добавить правый распознаватель жестов к подробному представлению, например:
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
[self configureView];
UISwipeGestureRecognizer *gestureRecognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipeHandler)];
[self.view addGestureRecognizer:gestureRecognizer];
}
-(void)swipeHandler{
NSLog(@"SWIPE");
}
Но этот код приводит к тому, что когда я просматриваю подробное представление, в консоли появляется журнал "SWIPE", но мастер-вид не отображается.
Как добавить признак распознавания жестов салфетки к подробному представлению, чтобы он не мешал отображению главного вида, и мой обработчик для распознавателя будет работать?
Спасибо заранее.
ИЗМЕНИТЬ. Я хочу, чтобы мой обработчик распознавания правой руки работал одновременно с этим встроенным в один, который показывает главный вид, но следующий код не является решением для этой конкретной ситуации:
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer{
return YES;
}