views:

347

answers:

6

I'm upgrading iPhone app and so far everything is going well (managed to resize screen display for most forms). However, I can't solve one problem - the touch is detected only in old, 320x480 region. Any ideas how can I solve that?

Thanks

EDIT: Here are the results when code for fetching superview bounds executes:

CGFloat wdth = self.view.superview.bounds.size.width;
NSLog(@"%d", wdth);
CGFloat hgth = self.view.superview.bounds.size.height;
NSLog(@"%d", hgth);

Result:

2010-04-16 14:25:36.268 xxx[14871:207] 0
2010-04-16 14:25:36.269 xxx[14871:207] 1073741824

Result for (%f):

2010-04-16 14:37:26.048 xxx[15053:207] -1.998374
2010-04-16 14:37:26.049 xxx[15053:207] 0.000000

Result for (%g):

2010-04-16 14:37:41.113 xxx[15084:207] -1.99837
2010-04-16 14:37:41.115 xxx[15084:207] 9.48221e-38
+1  A: 

I have seen similar behavior when a container view is set too small. The subviews will display fine but touches will not fire because the touches are happening outside of the superview.

MrHen
any idea how can I influence container view size?
kape123
Check the .superview of the view being touched. Once you have the superview, look at .bounds.size to see the size.So, if the view you are touching is called touchableView check touchableView.superview.bounds.size and make sure it has the correct dimensions.If it does, check the superview of the superview (touchableView.superview.superview.bounds.size). Keep doing until you run out of superviews. If nothing amongst the superviews seems out of place, this probably isn't the problem.Hope that helps.
MrHen
Got some really weird results... check EDIT
kape123
Hmm. What happens if you do the same outputs for self.view.bounds.size.width and .height?
MrHen
+3  A: 

http://iphonedevelopment.blogspot.com/2010/04/converting-iphone-apps-to-universal.html

In you AppDelegate:

- (void)applicationDidFinishLaunching:(UIApplication *)application {    

// stupid Apple...
CGRect rect = [[UIScreen mainScreen] bounds];
[window setFrame:rect]; 

// now, display your app
[window addSubview:rootController.view];
[window makeKeyAndVisible];
}
kape123
A: 

kape123 is correct

+1  A: 

In interface builder make sure that mainwindow-iPad "Full screen at launch" window attribute is checked.

ayman2010
A: 

The real problem here is that in the file MainWindow-iPad.xib, the Window object gets created with a size of 320 x 480. As ayman2010 mentions, setting the "Full screen at launch" fixes this.

Why would apple create an iPad window so small!!!???

Steve Reed Sr
A: 

Hi!

You may also open the (automatically created) MainWindow-iPad.xib in Interface Builder, select File/Create iPad Version, close the MainWindow-iPad.xib and save the unnamed new XIB (which has the correct size) over the old one.

BurninLeo

BurninLeo