Browse Tag: orientation

How to keep original orientation of the UIImage..

Hello All,

While working on an application, I was having the client’s requirement that, while displaying an image in imageview the image must be of same orientation same as the original.

After googling, I got the way for doing this.

Here is the way,

UIImage *image; //Here assign the image which you want

UIImageView *imageView = [[UIImageView alloc] init];

imageView.image = image;

imageView.contentMode = UIViewContentModeScaleAspectFit;

Setting this property gives the original orientation of the image.

So simple…

Happy Coding…. 🙂


Screen Orientations Methods in unity3d

There are 3 types of orientation in

Rotate only landscape

public void AutoOrientToLandScape() {

if(Vector3.Dot(Input.acceleration.normalized,new Vector3(1,0,0)) > 0.45)  { Screen.orientation=ScreenOrientation.LandscapeRight; }

else if(Vector3.Dot(Input.acceleration.normalized,new Vector3(-1,0,0)) > 0.45)  { Screen.orientation=ScreenOrientation.LandscapeLeft; } }

Rotate only Portrait

public void AutoOrientToPortrait() {

if(Vector3.Dot(Input.acceleration.normalized,new Vector3(1,0,0)) > 0.45)  { Screen.orientation=ScreenOrientation.Portrait; }

else if(Vector3.Dot(Input.acceleration.normalized,new Vector3(-1,0,0)) > 0.45)  { Screen.orientation=ScreenOrientation.PortraitUpsideDown; } }

Auto Orientation

public void AutoOrient() {

Screen.orientation=ScreenOrientation.AutoRotation; }

Need more help?

Hi there, was your problem or query resolved? If not & need more assistance, please do reach out to us at, we'll be more than delighted to help. Nanostuffs has 7+ years of extensive Salesforce & iOS/Android experience.
Holler Box