天道酬勤,学无止境

uiapplication

How did Vesper show users wallpaper without UIApplicationIsOpaque key?

An app named Vesper was updated for iOS 7 and shows the user's wallpaper on iOS 7. I have found that using UIApplicationIsOpaque key and UIBackgroundStyleLightBlur can show the users background but will not pass validation. Vesper passed validation and passed Apple. I did upload this question to the dev forums, but apple has taken it down.

2021-11-28 16:08:09    分类:问答    ios7   uiwindow   uiapplication

External Bluetooth Keyboard integration in IOS 7

I need to support external keyboard functionality in my app and need key combinations like Alt+Tab Tab to be detected in the app to trigger some event. In IOS 6 I had overridden the - (void)sendEvent:(UIEvent *)anEvent; function in the UIApplication subclass to get the key pressed combinations on external keyboard. But now I am testing my app in IOS 7 and the sendEvent doesn't even seem to get called for any hardware key pressed event. Any Solutions..?

2021-11-28 09:06:56    分类:问答    bluetooth   keyboard   ios7   uiapplication

将 UIView 或 UIViewController 放在所有其他之上(Keep a UIView or UIViewController on top of all others)

问题 我正在继承 UIApplication 以在我的 TouchDisplay 视图中拦截和显示触摸。 我想扩展 Application、Window、Delegate 或 Main ViewController,以便将我的 TouchDisplay 视图保持在所有其他视图之上。 在我和大多数其他应用程序工作时,视图和控制器一直在添加和删除。 我认为正确的答案将能够处理这些添加和删除,并且仍然将 TouchDisplay 视图保持在顶部。 谢谢你的帮助,乔 回答1 为此,您可以采取以下几种方法: 如果您只针对iOS 5+ 和 iPad ,您可以制作一个包含两个视图控制器的顶级视图控制器。 第一个是“TouchDisplay”视图的视图控制器。 第二个是应用程序的普通根视图控制器。 (即您现有的主视图控制器;您需要在此视图控制器上将definePresentationContext设置为YES) 由于您正在编写容器视图控制器,因此您可以随意订购这两个子视图。 WWDC 2011 上有一个关于视图控制器包含的讨论,其中详细介绍了这一点。 恕我直言,这是最“正确”的方法,因为它为您的 TouchDisplay 视图提供了一个视图控制器,处理旋转并且通常与其他人一起玩得很好。 (这只适用于 iPad,因为在 iPhone 上,新的模态视图总是覆盖全屏。)

2021-11-26 01:15:27    分类:技术分享    ios   uiview   uiviewcontroller   uiapplicationdelegate   uiapplication

Setting UIApplication statusBarHidden to YES does not work in iOS 7

I've been using [UIApplication sharedApplication].statusBarHidden = YES; to hide the status bar when users enter specific UIViewControllers in iOS 6 and it worked great. In iOS 7 however it still shows a translucent overlay.

2021-11-25 09:31:48    分类:问答    uiviewcontroller   statusbar   ios7   uiapplication

Accessing `shared` variable of `UIApplication` from inside `share extension` in Swift

I need to execute my host app from inside an extension. In Objective-C I've used this: // Get "UIApplication" class name through ASCII Character codes. NSString *className = [[NSString alloc] initWithData:[NSData dataWithBytes:(unsigned char []){0x55, 0x49, 0x41, 0x70, 0x70, 0x6C, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E} length:13] encoding:NSASCIIStringEncoding]; if (NSClassFromString(className)) { // A different way to call [UIApplication sharedApplication] id object = [NSClassFromString(className) performSelector: @selector(sharedApplication)]; // These lines invoke selector with 3

2021-11-24 22:53:22    分类:问答    ios   swift   xcode   uiapplication

Open Photos app programmatically

Is it possible to launch the "Photos" application from an iPhone app? Similar to launching mail? [[UIApplication sharedApplication] openURL:url];

2021-11-23 14:02:52    分类:问答    iphone   objective-c   ios   cocoa-touch   uiapplication

How does Booking.com close their app programmatically?

I just saw this trick the Booking.com app does to let you change the application's language: I'm not aware of any technique to programmatically close an iOS app (and it's also forbidden by Apple's guidelines, but let's "pretend" that my boss wants me to do this). How do they do it? I've tried exit(0) but it immediately quit like when the process crashes, while their app animates to the home screen normally. Is there maybe a private URL scheme that opens the home screen?

2021-11-21 08:15:34    分类:问答    ios   objective-c   swift   uiapplication

When should I release [[UIApplication sharedApplication] delegate] object?

I'm using the following code many times in my app (especially to manage a NavigationController): MyAppDelegate *appDelegate = [[UIApplication sharedApplication] delegate]; When should I release it ? Thx for helping, Stephane

2021-11-21 03:39:48    分类:问答    iphone   ios   ios4   uiapplicationdelegate   uiapplication

ios后台调用函数(ios call function in background mode)

问题 我的应用程序在后台运行,我想每 60 秒从 Web 服务器获取一次 html 数据。 (使用 alamofire 或 nsurlconnection 等。)但我找不到与之相关的示例代码。 有没有可能做这样的事情。 每分钟更新我想做的事。 在后台模式下运行的应用程序,我想每 60 秒调用一次 updateServer 函数 注意:后台获取方法不是每分钟都在工作。 func application(application: UIApplication, performFetchWithCompletionHandler completionHandler: (UIBackgroundFetchResult) -> Void) 此函数在 3 分钟后未在后台模式下调用 func updateServer() { self.requesti = request(.POST, "http://www.myserver.com/deerer.aspx" .response { request, response, data, error in let dataString = NSString(data: data!, encoding:NSUTF8StringEncoding) ....... let alis = scanned as! String let satis =

2021-11-21 00:05:39    分类:技术分享    ios   swift   alamofire   uiapplication

从 iOS 8 中的应用程序访问“设置”应用程序?(Accessing the Settings app from your app in iOS 8?)

问题 是否可以通过按钮或 iOS 8 中的任何内容从您自己的应用程序访问设置应用程序。我听说它在 iOS 5 中老化,是真的吗? 如果没有,iOS 8 中的方法是否发生了变化? 如果没有其他方法可以做到这一点,那么解决它的最佳方法是什么? 回答1 从 iOS 8 开始,可以将用户从您的应用程序直接带入设置应用程序。 它们将深入链接到您应用程序的特定设置页面,但它们可以返回到顶级设置屏幕。 如果您还支持 iOS 7,则需要先检查是否存在特定的字符串常量。 更新: 如果你的部署目标设置为 8.0 或更高版本,Xcode 6.3 会给你以下警告: Comparison of address of 'UIApplicationOpenSettingsURLString' not equal to a null pointer is always true 这是因为该功能从 8.0 开始可用,因此该指针永远不会为NULL 。 如果您的部署目标是 8.0+,只需删除下面的 if 语句。 if (&UIApplicationOpenSettingsURLString != NULL) { NSURL *appSettings = [NSURL URLWithString:UIApplicationOpenSettingsURLString]; [[UIApplication

2021-11-19 16:29:05    分类:技术分享    ios   uiapplication   ios8