From 59da5b720245fd01623045e12035fe6447dd3e9b Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Tue, 14 May 2019 07:55:42 -0700 Subject: [PATCH] [SDL] ios Touch Fix. --- src/video/uikit/SDL_uikitwindow.m | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/video/uikit/SDL_uikitwindow.m b/src/video/uikit/SDL_uikitwindow.m index 55a09a0a9..25e46ac6b 100644 --- a/src/video/uikit/SDL_uikitwindow.m +++ b/src/video/uikit/SDL_uikitwindow.m @@ -67,6 +67,20 @@ @implementation SDL_uikitwindow +- (void)didAddSubview:(UIView *)subview +{ + [super didAddSubview:subview]; + // We need to pach the enabled state in subviews as a Metal view gets added and covers up the SDL_uikitview that handles touch. + // So set needs layout so that the layout gets done (which is where we patch the flags) Johna. + NSArray* subviews = self.subviews; + for (int i=0; i<[subviews count]; i++) + { + UIView *view = [subviews objectAtIndex:i]; + // NSLog( @"View %p enabled %d\n", view, view.userInteractionEnabled ); + [view setNeedsLayout]; // force the subviews to layout. + } +} + - (void)layoutSubviews { /* Workaround to fix window orientation issues in iOS 8+. */