Skip to content

Commit 5280d61

Browse files
committed
-
1 parent 062d315 commit 5280d61

3 files changed

Lines changed: 13 additions & 1 deletion

File tree

Plugins/CS/NativeUI.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ namespace iOSNativePlugin
99
{
1010
public static class NativeUI
1111
{
12+
[DllImport("__Internal")] static extern void NativeUI_GetUnityViewSize(ref double x, ref double y);
1213
[DllImport("__Internal")] static extern void NativeUI_SafariViewFromUrl(string url, CompletionCallback onCompletionCallback);
1314
[DllImport("__Internal")] static extern void NativeUI_SafariPageSheetFromUrl(string url, CompletionCallback onCompletionCallback);
1415
[DllImport("__Internal")] static extern void NativeUI_RegisterStatusBarOrientationChangeCallback(OrientationChangeCallback callback);

Plugins/Native/Headers/NativeUI.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
//SFSafariViewControllerDelegate 实现SafariView回调协议
55
@interface NativeUI : NSObject <SFSafariViewControllerDelegate>
6+
+(CGSize)GetUnityViewSize;
67
+(void)SafariViewFromUrl:(NSString *)url onCompletionCallback:(CompletionCallback)callback;
78
+(void)SafariPageSheetFromUrl:(NSString *)url onCompletionCallback:(CompletionCallback)callback;
89
+(void)RegisterStatusBarOrientationChangeCallback:(OrientationChangeCallback)callback;
@@ -21,6 +22,13 @@
2122

2223
extern "C"
2324
{
25+
void NativeUI_GetUnityViewSize(double &x, double &y)
26+
{
27+
CGSize size = [NativeUI GetUnityViewSize];
28+
x = size.width;
29+
y = size.height;
30+
}
31+
2432
void NativeUI_SafariViewFromUrl(const char* url, CompletionCallback onCompletionCallback)
2533
{
2634
if(url == NULL)

Plugins/Native/Implementations/NativeUI.mm

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@
33

44

55
@implementation NativeUI
6-
6+
+(CGSize)GetUnityViewSize
7+
{
8+
return UnityGetGLViewController().view.frame.size;
9+
}
710
//获取单例
811
+(instancetype)Instance {
912

0 commit comments

Comments
 (0)