after some years I tried again to work with XCode to write some little apps for iOS.
My MainViewController contains these lines in viewdidload:
UIStoryboard* overviewStoryboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
UIViewController *overviewController = [overviewStoryboard instantiateViewControllerWithIdentifier:@"Overview"];
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:overviewController];
...
[self addChildViewController:nav];
[self.view addSubview:nav.view];
[nav didMoveToParentViewController:self];
the Controller behind the Overview contains the whole gesture recognition in view did load:
the property
@property (nonatomic, strong) UISwipeGestureRecognizer *swipeGestureUpDown;
viewdidload:
self.tableView.dataSource = self;
self.tableView.delegate = self;
// gesture recognizer top
self.swipeGestureUpDown = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipedScreen)];
self.swipeGestureUpDown.numberOfTouchesRequired = 1;
self.swipeGestureUpDown.direction = (UISwipeGestureRecognizerDirectionUp | UISwipeGestureRecognizerDirectionDown);
[self.view addGestureRecognizer:self.swipeGestureUpDown];
and swipedScreen only an nslog:
- (void)swipedScreen:(UISwipeGestureRecognizer*)gesture
{
NSLog(@"somewhere");
}
THE overviewcontroller contains a tableView with custom cells. The maincontroller passes this overviewcontroller as rootcontroller to a navigation, which should be slideUp if you swipeUp, and slideIn if you swipeDown. The maincontroller is calling the navigationcontroller with rootcontroller as you've seen above.
Nothing happens, no gesture is recognized, and in some tries it crashes with this message
unrecognized selector sent to instance
does somebody now what to do?