Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Detect device orientation and set UI according to orientation dynamically.

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 242
    Comment on it

    Hello Friends, these lines of code will help you to detect device orientation and set UI dynamically according to orientation.

    - (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation
    {
        NSLog(@"rotate");
        [self setUI];
    }
    
    -(void)setUI
    {
            if ((self.interfaceOrientation == UIInterfaceOrientationPortrait)||(self.interfaceOrientation == UIDeviceOrientationPortraitUpsideDown))
            {
                Bttn.frame = CGRectMake(258 ,407 ,112 ,33);
    
            }else
            {
                Bttn.frame = CGRectMake(384 ,407 ,112 ,33);
            }
    }
    

    It worked for me, hope it will work for you too.

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: