fix iOS screen rotation with keyboard

This commit is contained in:
2019-08-10 16:15:07 +02:00
parent db3e815d55
commit b43ed85c2a
3 changed files with 6 additions and 5 deletions

View File

@@ -227,7 +227,7 @@ std::recursive_mutex lock_mutex;
{ {
App::I->redraw = true; App::I->redraw = true;
App::I->animate = false; App::I->animate = false;
[self unregisterForKeyboardNotifications]; //[self unregisterForKeyboardNotifications];
} }
// Called when the UIKeyboardDidShowNotification is sent. // Called when the UIKeyboardDidShowNotification is sent.
@@ -237,7 +237,8 @@ std::recursive_mutex lock_mutex;
CGSize kbSize = [[info objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue].size; CGSize kbSize = [[info objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue].size;
GameView *view = (GameView *)self.view; GameView *view = (GameView *)self.view;
CGRect frame = view.frame; //CGRect frame = view.frame;
CGRect frame = [[UIScreen mainScreen] bounds];
frame.size.height -= kbSize.height; frame.size.height -= kbSize.height;
view.frame = frame; view.frame = frame;
@@ -409,7 +410,7 @@ std::set<UITouch*> ignored_touch;
{ {
App::I->redraw = true; App::I->redraw = true;
[self resignFirstResponder]; [self resignFirstResponder];
//[self registerForKeyboardNotifications]; [self registerForKeyboardNotifications];
} }
- (void)viewDidLoad - (void)viewDidLoad

View File

@@ -95,7 +95,7 @@ void App::showKeyboard()
redraw = true; redraw = true;
#ifdef __IOS__ #ifdef __IOS__
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
[ios_view registerForKeyboardNotifications]; //[ios_view registerForKeyboardNotifications];
[ios_view becomeFirstResponder]; [ios_view becomeFirstResponder];
}); });
#elif __ANDROID__ #elif __ANDROID__

View File

@@ -12,7 +12,7 @@ Sampler FontManager::m_sampler;
bool Font::load(const std::string& ttf, int font_size, float font_scale) bool Font::load(const std::string& ttf, int font_size, float font_scale)
{ {
Asset file; Asset file;
LOG("Font::load %s", ttf); LOG("Font::load %s", ttf.c_str());
if (file.open(ttf.c_str()) && file.read_all()) if (file.open(ttf.c_str()) && file.read_all())
{ {
path = ttf; path = ttf;