app: [iOS] replace ViewEvent.View with add ViewController field

For mixing native UI with Gio UI, the UIViewController is sometimes
needed, not just the UIView. This change replace the View field of
ViewEvent with ViewController.

Signed-off-by: Inkeliz <inkeliz@inkeliz.com>
This commit is contained in:
Inkeliz
2021-12-08 15:15:43 +00:00
committed by Elias Naur
parent 03016f0c69
commit 2a32ece084
2 changed files with 5 additions and 5 deletions
+4 -4
View File
@@ -87,8 +87,8 @@ import (
) )
type ViewEvent struct { type ViewEvent struct {
// View is a CFTypeRef for the UIView backing a Window. // ViewController is a CFTypeRef for the UIViewController backing a Window.
View uintptr ViewController uintptr
} }
type window struct { type window struct {
@@ -112,7 +112,7 @@ func init() {
} }
//export onCreate //export onCreate
func onCreate(view C.CFTypeRef) { func onCreate(view, controller C.CFTypeRef) {
w := &window{ w := &window{
view: view, view: view,
} }
@@ -128,7 +128,7 @@ func onCreate(view C.CFTypeRef) {
w.w.SetDriver(w) w.w.SetDriver(w)
views[view] = w views[view] = w
w.w.Event(system.StageEvent{Stage: system.StagePaused}) w.w.Event(system.StageEvent{Stage: system.StagePaused})
w.w.Event(ViewEvent{View: uintptr(view)}) w.w.Event(ViewEvent{ViewController: uintptr(controller)})
} }
//export gio_onDraw //export gio_onDraw
+1 -1
View File
@@ -30,7 +30,7 @@ CGFloat _keyboardHeight;
#endif #endif
drawView.preservesSuperviewLayoutMargins = YES; drawView.preservesSuperviewLayoutMargins = YES;
drawView.layoutMargins = UIEdgeInsetsMake(0, 0, 0, 0); drawView.layoutMargins = UIEdgeInsetsMake(0, 0, 0, 0);
onCreate((__bridge CFTypeRef)drawView); onCreate((__bridge CFTypeRef)drawView, (__bridge CFTypeRef)self);
[[NSNotificationCenter defaultCenter] addObserver:self [[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardWillChange:) selector:@selector(keyboardWillChange:)
name:UIKeyboardWillShowNotification name:UIKeyboardWillShowNotification