好久没来了,最近发现了一些好玩的玩意,也是项目中需要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

最低0.47元/天 解锁文章
1513

被折叠的 条评论
为什么被折叠?



