Reputation: 5082
I would like to get the current dimension of the screen. i used self.view.frame.size.width
NSLog(@"%f",self.view.frame.size.width)
so when I run in the iphone simulator , it will return 320 however, when i run in the ipad simulator, it will still return me 320
I have different nib files for iphone and ipad and they're getting the proper nib files and the target family is ipad/iphone it should return 768 and so i can resize the images according to that.
any ideas?
Upvotes: 0
Views: 1042
Reputation: 902
Make sure that
self.view.autoresizesSubviews=NO;
Imageview.autoresizingMask=NO;
is set to NO.
That will do your work
Upvotes: 0
Reputation: 51
First you check this:-
if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) and
if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
And also while allocating file:-
For iPhone:- ABController *controller = [[ABController alloc] initWithNibName:@"ABController~iPhone" bundle:nil];
For iPad:- ABController *controller = [[ABController alloc] initWithNibName:@"ABController~iPad" bundle:nil];
Upvotes: 0
Reputation: 4953
try and use these
CGFloat screenWidth = [UIScreen mainScreen].bounds.size.width;
CGFloat screenheight = [UIScreen mainScreen].bounds.size.height;
but UIScreen doesn't take into account the current interface orientation. you will have to check for that also
or directly check for the device type
if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
and
if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
Upvotes: 2
Reputation: 2625
Is your iPad Nib file being used when running in a iPad Simulator? Maybe you want to check by changing something (maybe, change the location of,say, a button) in the iPad's NIB. This way, when the App runs, you can check if it's the iPhone's NIB or iPad's Nib.
Upvotes: 0