Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

chhoda

macrumors 6502
Original poster
Oct 25, 2008
285
1
I have a viewcontroller class where I am doing

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Return YES for supported orientations
//return (interfaceOrientation == UIInterfaceOrientationPortrait);
return YES;
}

- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation // Notification of rotation ending.
{
NSLog(@"Orientation: %@", fromInterfaceOrientation);
}


but the log is never printed, does rotation work properly in simulator ? or i need to test that on device ?

ch
 

ghayenga

macrumors regular
Jun 18, 2008
190
0
I have a viewcontroller class where I am doing

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Return YES for supported orientations
//return (interfaceOrientation == UIInterfaceOrientationPortrait);
return YES;
}

- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation // Notification of rotation ending.
{
NSLog(@"Orientation: %@", fromInterfaceOrientation);
}


but the log is never printed, does rotation work properly in simulator ? or i need to test that on device ?

ch

You should be getting a crash with that code since a UIInterfaceOrientation is actually an integer. If I change the logging code to:

NSLog(@"Orientation: %d", fromInterfaceOrientation);

it works fine in the simulator.
 

chhoda

macrumors 6502
Original poster
Oct 25, 2008
285
1
i wish

I wish I got a crash even ! i put a breakpoint in both the functions and try debug, breakpoint is never hit !
 

bigsprocket

macrumors newbie
Dec 18, 2008
5
0
Then your viewcontroller isn't being used. Is there a reference to your viewcontroller in the main NIB file, and that's how you expect it to be instantiated? Can you post the rest of your code?
 

chhoda

macrumors 6502
Original poster
Oct 25, 2008
285
1
no luck yet !

Its quite a bit of code to post here. WOuld you mind which portions of the code you wanna have a look ?

> Is there a reference to your viewcontroller in the main NIB file, and that's how you expect it to be instantiated?

by the way, how would I verify this, if I am not sure ?

regards
CH
 

chhoda

macrumors 6502
Original poster
Oct 25, 2008
285
1
simulator settings ?

is there a simulator setting which blocks/releases these rotation events to viewcontroller ? I am getting this feeling because I see in my simulator, the native aplication like photos, safari, addressbook also do not respond to landscape potrait rotation

rgds
ch
 

ghayenga

macrumors regular
Jun 18, 2008
190
0
is there a simulator setting which blocks/releases these rotation events to viewcontroller ? I am getting this feeling because I see in my simulator, the native aplication like photos, safari, addressbook also do not respond to landscape potrait rotation

rgds
ch

No, there's not.

However your viewController may return YES for shouldAutoRotate but if something else further up the view controller stack *doesn't* then your view won't rotate anyway.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.