我想获取pageViewController的当前索引,我不知道如何获取可见页面索引.
func pageViewController(pageViewController: UIPageViewController, didFinishAnimating finished: Bool,previousViewControllers: [UIViewController],transitionCompleted completed: Bool)
{
// How to get it?
}
Run Code Online (Sandbox Code Playgroud) uiviewcontroller uipagecontrol ios uipageviewcontroller swift
我正试图在屏幕上获取触摸的坐标,以显示弹出菜单
如何在页面视图控制器中使用
我在这做错了什么?
override func touchesBegan(touches: Set<UITouch>, withEvent event: UIEvent?) {
if let touch = touches.first {
let position = touch.locationInView(view)
print(position)
}
}
Run Code Online (Sandbox Code Playgroud) 我在Android 4.4上部署了带有Android SDK的v19的phonegap.我在我的index.html文件所在的文件夹中有一个mp3文件,我想用html5音频标签播放.
<html>
<body>
<audio controls>
<source src='sound.mp3' type='audio/mpeg'>
</audio>
</body>
<script type="text/javascript" src="cordova.js"></script>
</html>
Run Code Online (Sandbox Code Playgroud)
它不起作用,但失败如下:
I/AwesomePlayer( 124): setDataSource_l(URL suppressed)
E/ ( 124): Failed to open file '/android_asset/www/sound.mp3'. (No such file or directory)
Run Code Online (Sandbox Code Playgroud)
它看起来像一个路径问题,但我已经尝试了我能想到的所有排列.我认为它更为基础,就像AwesomePlayer无法访问存储在android_asset目录中的mp3.
使用Media插件进行phonegap工作正常,因为其他答案已经建议,但由于音频标签适用于外部媒体,而Media插件适用于内部媒体,因此似乎应该可以轻松修复.我还有一个巨大的工作应用程序,在任何地方使用音频标签,我真的不想重写它使用媒体插件.是否有一个简单的明显修复,或者我应该提交错误报告?
我在phonegap开发一个Android应用程序.我必须存储应该受到保护的json数据.json包含身份验证密钥和令牌,因此不应公开.所以我不能将它存储到任何类型的JavaScript本地存储.有没有其他方法可以安全地保存数据?
我正在尝试集成S3上传以上传视频文件并尝试使用Developer认证身份方法.根据aws文档说的所有内容都配置完成.
DeveloperAuthenticatedIdentityProvider类:
class DeveloperAuthenticatedIdentityProvider : AWSCognitoCredentialsProviderHelper {
override func token() -> AWSTask<NSString> {
//return AWSTask //with token and will set identityId
}
Run Code Online (Sandbox Code Playgroud)
然后
let devAuth = DeveloperAuthenticatedIdentityProvider(regionType: COGNITO_REGION, identityPoolId: COGNITO_POOL_ID, useEnhancedFlow: true, identityProviderManager:nil)
let credentialsProvider =
AWSCognitoCredentialsProvider(regionType: COGNITO_REGION, identityProvider:devAuth)
let configuration =
AWSServiceConfiguration(region: S3_REGION, credentialsProvider:credentialsProvider)
AWSServiceManager.default().defaultServiceConfiguration = configuration
Run Code Online (Sandbox Code Playgroud)
配置这些东西之后尝试使用AWSS3TransferManager上传
let transferManager = AWSS3TransferManager.default()
let uploadingFileURL = URL(fileURLWithPath: "your/file/path/myTestFile.txt")
let uploadRequest = AWSS3TransferManagerUploadRequest()
uploadRequest.bucket = "myBucket"
uploadRequest.key = "myTestFile.txt"
uploadRequest.body = uploadingFileURL
transferManager.upload(uploadRequest).continueWith(executor: AWSExecutor.mainThread(), block: { (task:AWSTask<AnyObject>) …Run Code Online (Sandbox Code Playgroud)