访问的ViewController在iOS的原生扩展针对Adobe AIR [英] Access ViewController in iOS-Native Extension for Adobe Air

查看:138
本文介绍了访问的ViewController在iOS的原生扩展针对Adobe AIR的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

短: 对于气本机扩展的Andr​​oid的API提供了一个getActivity()的上下文对象上。 我在寻找一种方式,来得到当前的ViewController在iOS中,本机扩展

Short: The Android-API for Air-Native-Extensions provides a getActivity() on the Context-Object. I am looking for a way, to get the current ViewController in iOS-Native-Extensions

龙: 我们需要空气扩展的不仅仅是一些iOS的-API调用来访问振动等,但要显示一个视图(MPMediaPickerController选择从iTunes资料库文件)。在主题为原生扩展了Adobe MAX 2011 (http://tv.adobe.com/watch/max-2011-develop/how-to-extend-your-mobile-air-applications-using-native-extensions/)奥利弗·戈德曼说,它是好的,通过使用原生扩展,以显示完整发表意见。 要显示MPMediaPickerController(或任何其他View),我需要调用当前的ViewController presentModalViewController或需要访问导航控制器。 我希望有一种方式来获得一个指向控制器莫名其妙,但我还没有发现任何文件建立了。

Long: We need to extend Air with more than just some iOS-API-Calls to access vibration etc, but want to display a View (MPMediaPickerController to select a File from the iTunes library). In the Keynote to native extensions on Adobe MAX 2011 (http://tv.adobe.com/watch/max-2011-develop/how-to-extend-your-mobile-air-applications-using-native-extensions/) Oliver Goldman said, it is okay to show complete Views by using native extensions. To show the MPMediaPickerController (or any other View), I need to call presentModalViewController on the current ViewController or need access to the Navigation Controller. I hoped there is a way to get a pointer to the controller somehow, but I have not found any documentaion about it.

推荐答案

您可以使用这块code。它的工作原理。

You can use this piece of code. It works.

UIViewController * myViewController;
id delegate = [[UIApplication sharedApplication] delegate];
UIWindow * win = [delegate window];
myViewController = [[MyView alloc] init];
// CGRect rect = CGRectMake(x,y,w,h);
// init the view position some how  myViewController.viewFrame = rect;

[win addSubview:myViewController.view];

希望这有助于。

Hope this helps.

最好的, 埃米尔

这篇关于访问的ViewController在iOS的原生扩展针对Adobe AIR的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆