mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-01 07:35:40 +00:00
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:
+4
-4
@@ -87,8 +87,8 @@ import (
|
||||
)
|
||||
|
||||
type ViewEvent struct {
|
||||
// View is a CFTypeRef for the UIView backing a Window.
|
||||
View uintptr
|
||||
// ViewController is a CFTypeRef for the UIViewController backing a Window.
|
||||
ViewController uintptr
|
||||
}
|
||||
|
||||
type window struct {
|
||||
@@ -112,7 +112,7 @@ func init() {
|
||||
}
|
||||
|
||||
//export onCreate
|
||||
func onCreate(view C.CFTypeRef) {
|
||||
func onCreate(view, controller C.CFTypeRef) {
|
||||
w := &window{
|
||||
view: view,
|
||||
}
|
||||
@@ -128,7 +128,7 @@ func onCreate(view C.CFTypeRef) {
|
||||
w.w.SetDriver(w)
|
||||
views[view] = w
|
||||
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
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@ CGFloat _keyboardHeight;
|
||||
#endif
|
||||
drawView.preservesSuperviewLayoutMargins = YES;
|
||||
drawView.layoutMargins = UIEdgeInsetsMake(0, 0, 0, 0);
|
||||
onCreate((__bridge CFTypeRef)drawView);
|
||||
onCreate((__bridge CFTypeRef)drawView, (__bridge CFTypeRef)self);
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||
selector:@selector(keyboardWillChange:)
|
||||
name:UIKeyboardWillShowNotification
|
||||
|
||||
Reference in New Issue
Block a user