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)