0

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?

John
  • 10,839
  • 8
  • 26
  • 31
  • What's your `buttonTitle:target:selector:frame:image:` method look like. Maybe it's setting up the frame or bounds incorrectly? – Daniel Dickison Dec 28 '10 at 15:54

2 Answers2

1

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

Mantar
  • 2,710
  • 5
  • 23
  • 30
  • I don't have anything else placed in the way of the UIButton. I was wondering if it had to do with exceeding what the bound would be in portrait mode (beyond 768 pixels), but I am always operating in landscape mode. – John Dec 28 '10 at 15:43
  • If your view is set to landscape, you shouldn't have any issues there. – Mantar Dec 28 '10 at 15:52
  • You can find the HOWTO here http://stackoverflow.com/questions/2647786/landscape-mode-only-for-iphone-or-ipad – Mantar Dec 28 '10 at 15:53
0

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

namannam
  • 169
  • 5