本文整理汇总了Java中org.robovm.apple.foundation.NSDictionary.put方法的典型用法代码示例。如果您正苦于以下问题:Java NSDictionary.put方法的具体用法?Java NSDictionary.put怎么用?Java NSDictionary.put使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.robovm.apple.foundation.NSDictionary
的用法示例。
在下文中一共展示了NSDictionary.put方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: logEventWithParametersAction
import org.robovm.apple.foundation.NSDictionary; //导入方法依赖的package包/类
private void logEventWithParametersAction() {
UIAlertView alert = new UIAlertView("Log Event with Parameters", "Select parameters:",
new UIAlertViewDelegateAdapter() {
@Override
public void clicked(UIAlertView alertView, long buttonIndex) {
final String eventName = "Event_with_Parameters";
switch ((int) buttonIndex) {
case 1:
Map<String, String> params1 = new HashMap<>();
params1.put("Param1", String.valueOf(101));
Flurry.logEvent(eventName, params1);
break;
case 2:
NSDictionary<?, ?> params2 = new NSMutableDictionary<>();
params2.put("Param1", "Test");
params2.put("Param2", 202);
Flurry.logEvent(eventName, params2);
break;
default:
break;
}
}
}, "Cancel", "Param1 = 101", "Param1 = Test, Param2 = 202");
alert.show();
}
示例2: scheduleLocalNotification
import org.robovm.apple.foundation.NSDictionary; //导入方法依赖的package包/类
/**
* Schedule a local notification.
*
* @param id
* @param title
* @param message
* @param action
* @param fireDate
*/
public void scheduleLocalNotification(String id, String category, String title, String message, String action,
Date fireDate) {
UILocalNotification notification = new UILocalNotification();
NSDictionary<?, ?> userInfo = new NSMutableDictionary<>();
userInfo.put(LOCAL_NOTIFICATION_ID_KEY, id);
notification.setUserInfo(userInfo);
notification.setAlertTitle(title);
notification.setAlertBody(message);
notification.setAlertAction(action);
notification.setFireDate(new NSDate(fireDate));
if (category != null) {
// This will make the notification actionable.
notification.setCategory(category);
}
UIApplication.getSharedApplication().scheduleLocalNotification(notification);
}
示例3: prepareForSegue
import org.robovm.apple.foundation.NSDictionary; //导入方法依赖的package包/类
@Override
public void prepareForSegue(UIStoryboardSegue segue, NSObject sender) {
if (shortcutItem == null) {
throw new RuntimeException("shortcutItem was not set");
}
if (segue.getIdentifier().equals("ShortcutDetailUpdated")) {
// In the updated case, create a shortcut item to represent the
// final state of the view controller.
UIApplicationShortcutIconType iconType = getIconTypeForSelectedRow((int) pickerView.getSelectedRow(0));
UIApplicationShortcutIcon icon = new UIApplicationShortcutIcon(iconType);
NSDictionary<NSString, ?> info = new NSMutableDictionary<>();
info.put(ApplicationShortcuts.APPLICATION_SHORTCUT_USER_INFO_ICON_KEY, pickerView.getSelectedRow(0));
shortcutItem = new UIApplicationShortcutItem(shortcutItem.getType(), titleTextField.getText(),
subtitleTextField.getText(), icon, info);
}
}
示例4: convertStringMapToDictionary
import org.robovm.apple.foundation.NSDictionary; //导入方法依赖的package包/类
private NSDictionary<NSString, NSString> convertStringMapToDictionary(Map<String, String> map) {
NSDictionary<NSString, NSString> result = new NSMutableDictionary<>();
if (map != null) {
for (Map.Entry<String, String> entry : map.entrySet()) {
result.put(new NSString(entry.getKey()), new NSString(entry.getValue()));
}
}
return result;
}
示例5: didFinishLaunching
import org.robovm.apple.foundation.NSDictionary; //导入方法依赖的package包/类
@Override
public boolean didFinishLaunching(UIApplication application, UIApplicationLaunchOptions launchOptions) {
// Override point for customization after application launch.
boolean shouldPerformAdditionalDelegateHandling = true;
// If a shortcut was launched, display its information and take the
// appropriate action
if (launchOptions != null) {
launchedShortcutItem = launchOptions.getShortcutItem();
}
// This will block "performActionForShortcutItem:completionHandler" from
// being called.
shouldPerformAdditionalDelegateHandling = false;
// Install initial versions of our two extra dynamic shortcuts.
NSArray<UIApplicationShortcutItem> shortcutItems = application.getShortcutItems();
if (shortcutItems == null || shortcutItems.isEmpty()) {
// Construct the items.
UIApplicationShortcutItem shortcut3 = new UIMutableApplicationShortcutItem(SHORTCUT_THIRD, "Play");
shortcut3.setLocalizedSubtitle("Will Play an item");
shortcut3.setIcon(new UIApplicationShortcutIcon(UIApplicationShortcutIconType.Play));
NSDictionary<NSString, ?> info3 = new NSMutableDictionary<>();
info3.put(APPLICATION_SHORTCUT_USER_INFO_ICON_KEY, UIApplicationShortcutIconType.Play.ordinal());
shortcut3.setUserInfo(info3);
UIApplicationShortcutItem shortcut4 = new UIMutableApplicationShortcutItem(SHORTCUT_FOURTH, "Pause");
shortcut4.setLocalizedSubtitle("Will Pause an item");
shortcut4.setIcon(new UIApplicationShortcutIcon(UIApplicationShortcutIconType.Pause));
NSDictionary<NSString, ?> info4 = new NSMutableDictionary<>();
info4.put(APPLICATION_SHORTCUT_USER_INFO_ICON_KEY, UIApplicationShortcutIconType.Pause.ordinal());
shortcut4.setUserInfo(info4);
// Update the application providing the initial 'dynamic' shortcut
// items.
application.setShortcutItems(new NSArray<>(shortcut3, shortcut4));
}
return shouldPerformAdditionalDelegateHandling;
}