[SDL] ios Touch Fix.
authorSam Lantinga <slouken@libsdl.org>
Tue, 14 May 2019 07:55:42 -0700
changeset 1272824cff6812c23
parent 12727 7bbbfe01d943
child 12729 a82d3c08d359
[SDL] ios Touch Fix.
src/video/uikit/SDL_uikitwindow.m
     1.1 --- a/src/video/uikit/SDL_uikitwindow.m	Sat May 11 12:41:21 2019 -0400
     1.2 +++ b/src/video/uikit/SDL_uikitwindow.m	Tue May 14 07:55:42 2019 -0700
     1.3 @@ -67,6 +67,20 @@
     1.4  
     1.5  @implementation SDL_uikitwindow
     1.6  
     1.7 +- (void)didAddSubview:(UIView *)subview
     1.8 +{
     1.9 +	[super didAddSubview:subview];
    1.10 +	// We need to pach the enabled state in subviews as a Metal view gets added and covers up the SDL_uikitview that handles touch.
    1.11 +	// So set needs layout so that the layout gets done (which is where we patch the flags) Johna.
    1.12 +    NSArray<UIView*>* subviews = self.subviews;
    1.13 +	for (int i=0; i<[subviews count]; i++)
    1.14 +	{
    1.15 +		UIView *view = [subviews objectAtIndex:i];
    1.16 +		// NSLog( @"View %p enabled %d\n", view, view.userInteractionEnabled );
    1.17 +		[view setNeedsLayout];  // force the subviews to layout.
    1.18 +	}
    1.19 +}
    1.20 +
    1.21  - (void)layoutSubviews
    1.22  {
    1.23      /* Workaround to fix window orientation issues in iOS 8+. */