Skip to content

Commit

Permalink
fixed iOS code to allow select tag menu, etc.
Browse files Browse the repository at this point in the history
  • Loading branch information
KojiNakamaru committed Nov 30, 2023
1 parent 8e55ce6 commit 99caa99
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
14 changes: 14 additions & 0 deletions plugins/Editor/UnityWebViewPostprocessBuild.cs
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,20 @@ public static void OnPostprocessBuild(BuildTarget buildTarget, string path) {
}
File.WriteAllText(projPath, dst);

// Classes/UI/UnityAppController+ViewHandling.mm
{
var text = File.ReadAllText(path + "/Classes/UI/UnityAppController+ViewHandling.mm");
text = text.Replace(
@"
_rootController.view = _rootView = _unityView;
",
@"
UIView *view = [[UIView alloc] initWithFrame:controller.view.bounds];
[view addSubview:_unityView];
_rootController.view = _rootView = view;
");
File.WriteAllText(path + "/Classes/UI/UnityAppController+ViewHandling.mm", text);
}
// Classes/UI/UnityView.h
{
var lines0 = File.ReadAllText(path + "/Classes/UI/UnityView.h").Split('\n');
Expand Down
2 changes: 1 addition & 1 deletion plugins/iOS/WebView.mm
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ - (id)initWithGameObjectName:(const char *)gameObjectName_ transparent:(BOOL)tra

[webView addObserver:self forKeyPath: @"loading" options: NSKeyValueObservingOptionNew context:nil];

[view.superview insertSubview:webView atIndex:0];
[view insertSubview:webView atIndex:0];

return self;
}
Expand Down
2 changes: 1 addition & 1 deletion plugins/iOS/WebViewWithUIWebView.mm
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ - (id)initWithGameObjectName:(const char *)gameObjectName_ transparent:(BOOL)tra

[webView addObserver:self forKeyPath: @"loading" options: NSKeyValueObservingOptionNew context:nil];

[view.superview insertSubview:webView atIndex:0];
[view insertSubview:webView atIndex:0];

return self;
}
Expand Down

0 comments on commit 99caa99

Please sign in to comment.