views:

35

answers:

2

I need to support only portrait orientation in my app. How can I do it? I have tried adding

<key>UISupportedInterfaceOrientations</key>
<array>
    <string>UIInterfaceOrientationPortrait</string>
</array>

and

 -(BOOL)     shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return UIInterfaceOrientationPortrait;
}

But it does't help - the view rotates anyway.

Thanks in advance!

+1  A: 

-(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientationshould return a BOOL which is NOin your case.

tob
That was really the reason. I'm sorry for my stupidity :(
Knodel
Please accept the answer if it solved your problem, thanks.
tob
+2  A: 

This should be:

 -(BOOL)     shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 
{
    return interfaceOrientation == UIInterfaceOrientationPortrait 
           || interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown ;
}
JBRWilkinson