Allowing a sub view to detect a touch within it //SETUP TO RECEIVE TAPS UITapGestureRecognizer *singleTapGestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleSingleTap:)]; singleTapGestureRecognizer.numberOfTapsRequired = 1; [self.view addGestureRecognizer:singleTapGestureRecognizer]; //********** VIEW TAPPED ********** -(void) handleSingleTap:(UITapGestureRecognizer *)sender { NSLog(@”Touched”); }
Category: Subviews
Adding Subviews Programmatically
Create the Sub View Create a view as normal Menu > File > New File > iOS > Cocao Touch > UIViewControllerSubClass Subclass of > UIViewController With XIB for user interface = Checked Name it (“#ViewController”, ending with “_iPhone” and “_iPad” for multi device apps, is a good naming convention) In interface builder select the […]