diff --git a/cocos/ui/UIEditBox/UIEditBoxImpl-mac.mm b/cocos/ui/UIEditBox/UIEditBoxImpl-mac.mm index 9a4c4617cf..fc5059ec64 100644 --- a/cocos/ui/UIEditBox/UIEditBoxImpl-mac.mm +++ b/cocos/ui/UIEditBox/UIEditBoxImpl-mac.mm @@ -198,7 +198,7 @@ - (void)openKeyboard { - NSView *contentView = [self getNSWindow].contentView; + NSView *contentView = self.window.contentView; if (!_secure) { [contentView addSubview:_textField];