Unity与iOS间的调用

好久没来了,最近发现了一些好玩的玩意,也是项目中需要unity中要调用Native,之前也一直没接触过,后来通过查找资料一步步的打包测试终于也算是把这个问题解决了,话不多说,上码!

就以unity中调用iOS的datePicker为例

1、在xcode中写好OC的UIDatePicker为后期调用做准备

static iOSDatePicker *shareInstance;

+ (id)shareInstance {
    if (shareInstance == nil) {
        shareInstance = [[self alloc] init];
    }
    return shareInstance;
}

static UIDatePicker *datePicker;

- (void)showDatePicker {
    if (datePicker != nil) {
        [self removeViews:nil];
    }
    UIViewController *vc = UnityGetGLViewController();
    CGRect toolbarTargetFrame = CGRectMake(0, vc.view.bounds.size.height-216-44, vc.view.frame.size.width, 44);
    CGRect datePickerTargetFrame = CGRectMake(0, vc.view.bounds.size.height-216, vc.view.frame.size.width, 216);
    CGRect darkViewTargetFrame = CGRectMake(0, vc.view.bounds.size.height-216-44, vc.view.frame.size.width, 260);

    UIView *darkView = [[UIView alloc] initWithFrame:CGRectMake(0, vc.view.bounds.size.height, vc.view.frame.size.width, 260)];
    darkView.alpha = 1;
    darkView.backgroundColor = [UIColor whiteColor
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值