mirror of https://github.com/axmolengine/axmol.git
fix ios8 EditBox orientation problem
This commit is contained in:
parent
efa1c86fc5
commit
34fbca9c50
|
@ -731,7 +731,7 @@ Copyright (C) 2008 Apple Inc. All Rights Reserved.
|
||||||
CGSize viewSize = self.frame.size;
|
CGSize viewSize = self.frame.size;
|
||||||
CGFloat tmp;
|
CGFloat tmp;
|
||||||
|
|
||||||
switch ([[UIApplication sharedApplication] statusBarOrientation])
|
switch (getFixedOrientation([[UIApplication sharedApplication] statusBarOrientation]))
|
||||||
{
|
{
|
||||||
case UIInterfaceOrientationPortrait:
|
case UIInterfaceOrientationPortrait:
|
||||||
begin.origin.y = viewSize.height - begin.origin.y - begin.size.height;
|
begin.origin.y = viewSize.height - begin.origin.y - begin.size.height;
|
||||||
|
@ -744,15 +744,9 @@ Copyright (C) 2008 Apple Inc. All Rights Reserved.
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case UIInterfaceOrientationLandscapeLeft:
|
case UIInterfaceOrientationLandscapeLeft:
|
||||||
tmp = begin.size.width;
|
std::swap(begin.size.width, begin.size.height);
|
||||||
begin.size.width = begin.size.height;
|
std::swap(end.size.width, end.size.height);
|
||||||
begin.size.height = tmp;
|
std::swap(viewSize.width, viewSize.height);
|
||||||
tmp = end.size.width;
|
|
||||||
end.size.width = end.size.height;
|
|
||||||
end.size.height = tmp;
|
|
||||||
tmp = viewSize.width;
|
|
||||||
viewSize.width = viewSize.height;
|
|
||||||
viewSize.height = tmp;
|
|
||||||
|
|
||||||
tmp = begin.origin.x;
|
tmp = begin.origin.x;
|
||||||
begin.origin.x = begin.origin.y;
|
begin.origin.x = begin.origin.y;
|
||||||
|
@ -763,15 +757,9 @@ Copyright (C) 2008 Apple Inc. All Rights Reserved.
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case UIInterfaceOrientationLandscapeRight:
|
case UIInterfaceOrientationLandscapeRight:
|
||||||
tmp = begin.size.width;
|
std::swap(begin.size.width, begin.size.height);
|
||||||
begin.size.width = begin.size.height;
|
std::swap(end.size.width, end.size.height);
|
||||||
begin.size.height = tmp;
|
std::swap(viewSize.width, viewSize.height);
|
||||||
tmp = end.size.width;
|
|
||||||
end.size.width = end.size.height;
|
|
||||||
end.size.height = tmp;
|
|
||||||
tmp = viewSize.width;
|
|
||||||
viewSize.width = viewSize.height;
|
|
||||||
viewSize.height = tmp;
|
|
||||||
|
|
||||||
tmp = begin.origin.x;
|
tmp = begin.origin.x;
|
||||||
begin.origin.x = begin.origin.y;
|
begin.origin.x = begin.origin.y;
|
||||||
|
@ -850,6 +838,15 @@ Copyright (C) 2008 Apple Inc. All Rights Reserved.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UIInterfaceOrientation getFixedOrientation(UIInterfaceOrientation statusBarOrientation)
|
||||||
|
{
|
||||||
|
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0)
|
||||||
|
{
|
||||||
|
statusBarOrientation = UIInterfaceOrientationPortrait;
|
||||||
|
}
|
||||||
|
return statusBarOrientation;
|
||||||
|
}
|
||||||
|
|
||||||
-(void) doAnimationWhenKeyboardMoveWithDuration:(float)duration distance:(float)dis
|
-(void) doAnimationWhenKeyboardMoveWithDuration:(float)duration distance:(float)dis
|
||||||
{
|
{
|
||||||
[UIView beginAnimations:nil context:nullptr];
|
[UIView beginAnimations:nil context:nullptr];
|
||||||
|
@ -869,7 +866,7 @@ Copyright (C) 2008 Apple Inc. All Rights Reserved.
|
||||||
dis /= 2.0f;
|
dis /= 2.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ([[UIApplication sharedApplication] statusBarOrientation])
|
switch (getFixedOrientation([[UIApplication sharedApplication] statusBarOrientation]))
|
||||||
{
|
{
|
||||||
case UIInterfaceOrientationPortrait:
|
case UIInterfaceOrientationPortrait:
|
||||||
self.frame = CGRectMake(originalRect_.origin.x, originalRect_.origin.y - dis, originalRect_.size.width, originalRect_.size.height);
|
self.frame = CGRectMake(originalRect_.origin.x, originalRect_.origin.y - dis, originalRect_.size.width, originalRect_.size.height);
|
||||||
|
|
Loading…
Reference in New Issue