一点背景:
我在Libgdx开发了一款游戏并将其上传到iTunes应用商店。我的应用程序被拒绝了,原因如下:(这不是问题,但我想向您介绍一下我想要实现的目标)
Dropwizard Metrics
我的应用只会将高分上传到我的服务器。但是好的,如果Apple声明用户应该知道这一点,我会说清楚。
实际任务:
自从我用Java制作这个应用以来,我对Objective-c编程一无所知。但我知道iOS有一些安全对话框,提示用户是否可以在应用程序中使用以下功能或数据。
我想调用这种对话框(用我自己的信息)
我也知道它应该在我的info.plist文件中定义,但我不知道如何在运行时访问它并在我的游戏中显示它。
有人知道如何打开它吗?
答案 0 :(得分:0)
您可以尝试我的libgdx扩展程序用于对话框窗口:https://github.com/TomGrill/gdx-dialogs
或:
您需要与平台规范代码进行交互:https://github.com/libgdx/libgdx/wiki/Interfacing-with-platform-specific-code
在iOS界面实现中使用UIAlertView类打开AlertView:
代码示例:
UIAlertViewDelegateAdapter delegate = new UIAlertViewDelegateAdapter() {
@Override
public void didDismiss(UIAlertView alertView, long buttonIndex) {
//handle button click based on buttonIndex
}
@Override
public void clicked(UIAlertView alertView, long buttonIndex) {
}
@Override
public void cancel(UIAlertView alertView) {
}
@Override
public void willPresent(UIAlertView alertView) {
}
@Override
public void didPresent(UIAlertView alertView) {
}
@Override
public void willDismiss(UIAlertView alertView, long buttonIndex) {
}
@Override
public boolean shouldEnableFirstOtherButton(UIAlertView alertView) {
return false;
}
};
String[] otherButtons = new String[1];
otherButtons[0] = "No";
String firstButton = "Yes";
UIAlertView alertView = new UIAlertView("Title", "message", delegate, firstButton, otherButtons);
alertView.show();