John
John

Reputation: 10969

Part of UIButton on iPad display is not clickable

I am currently developing an iPad application that has a Pause button. The entire pause button is played on the screen, but only the left-most portion (the left edge and then the P in PAUSE registers as a click on the screen).

The program only operates in landscape orientation, and the button is set up as follows:

UIImage *buttonImage = [UIImage imageNamed:@"pause_button.png"];
CGRect buttonFrame = CGRectMake(700.0, 400.0, buttonImage.size.width, buttonImage.size.height);
pauseButton = [self buttonWithTitle:nil target:self selector:@selector(togglePauseButton:) frame:buttonFrame image:buttonImage];

...

[self addSubview:pauseButton];

If I adjust the location from 700.0, 400.0 to 225.0, 620.0, the entire button is clickable.

Is there a way to make the entire button clickable with the 700.0, 400.0 origin point?

Upvotes: 0

Views: 588

Answers (2)

namannam
namannam

Reputation: 169

just use CGRectMake(700.0, 400.0, buttonImage.frame.size.width, buttonImage.frame.size.height)

Upvotes: 0

Mantar
Mantar

Reputation: 2720

The most likely cause here is that you have another layer swallowing touches in the area where the Pause isn't tappable.

Upvotes: 1

Related Questions