m.y
m.y

Reputation: 691

Accessibility label wih iOS ViewController presented as a form sheet

I am making use of a Presentation: Form Sheet in my app. So my ViewController gets displayed as a form with the black semi-transparent overlay around it.

I have implemented the logic to dismiss everything should the user tap anywhere outside my form sheet ViewController.

I would like to test this behavior but I'm not sure how to simulate the tap. How can I set an accessibility label to simulate this tap with a UI test?

Or any other suggestions how I can test this behavior?

Thanks!

Upvotes: 0

Views: 501

Answers (2)

Norman
Norman

Reputation: 176

You just want to click anywhere on the screen to dismiss everything?

    [tester tapScreenAtPoint:CGPoint];

does that for you.

Most stuff about KIF is explained here: http://www.raywenderlich.com/61419/ios-ui-testing-with-kif

Upvotes: 1

iamyogish
iamyogish

Reputation: 2432

Hi you can use UITapGestureRecognizer like this :

First create an instance of UITapGestureRecognizer

UITapGestureRecognizer *tapGesture = tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(someMethod:)];

Then attach this gesture recognizer to your view (i.e, black overlay you're talking about )

[self.view addGestureRecognizer:tapGesture];

Then implement someMethod: which is the method (action) that gets called when your formsheet is tapped

-(void)someMethod
{
 //Logic to dismiss your formsheet 
}

HTH :D

Upvotes: 0

Related Questions