uiapplication

External Bluetooth Keyboard integration in IOS 7

て烟熏妆下的殇ゞ 提交于 2019-12-03 13:17:02
问题 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..? 回答1: There is a 100% supported way to

Finding the rootViewController in iOS

我的未来我决定 提交于 2019-12-03 12:11:27
In ShareKit, the code needs to determine where the rootViewController is so it can show a modal view. For some reason, the code is failing in iOS 5: // Try to find the root view controller programmically // Find the top window (that is not an alert view or other window) UIWindow *topWindow = [[UIApplication sharedApplication] keyWindow]; if (topWindow.windowLevel != UIWindowLevelNormal) { NSArray *windows = [[UIApplication sharedApplication] windows]; for(topWindow in windows) { if (topWindow.windowLevel == UIWindowLevelNormal) break; } } UIView *rootView = [[topWindow subviews] objectAtIndex

UIApplication's -canOpenURL: -openURL: return misleading result

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-03 07:09:52
问题 Since iOS6, I can't tell whether the application can launch Safari or not. If Safari is restricted on the device (Settings>General>Restrictions), nothing happens when trying to open a URL, and there's no indication of what went wrong: NSURL *url = [NSURL URLWithString:@"http://www.google.com"]; [[UIApplication sharedApplication] canOpenURL:url]; // Returns YES [[UIApplication sharedApplication] openURL:url]; // Returns YES However, Safari does not launch, and the user is left wondering why my

How did Vesper show users wallpaper without UIApplicationIsOpaque key?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-03 06:39:13
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. Brent Simmons has written a blog post explaining it. It seems like they didn't use UIApplicationIsOpaque key. The Sidebar In 1.0 our sidebar menu included a bit of top and bottom padding to blend into the black of the status bar and — along with a touch of

UIApplication openUrl not working with formatted NSString

做~自己de王妃 提交于 2019-12-03 05:53:20
I have the following code to open google maps: NSString *urlString = [NSString stringWithFormat:@"http://maps.google.com/maps?q=%@, Anchorage, AK",addressString]; [[UIApplication sharedApplication] openURL:[NSURL URLWithString:urlString]]; But it doesn't work and there is no error. It just doesn't open. URLWithString requires a percent-escaped string. Your sample url contains spaces which results in a nil NSURL being created. Additionally, the addressString may also contain characters that need to be escaped. Try percent-escaping the url string first: NSString *urlString = [NSString

What is the relationship between AppDelegate, RootViewController, and UIApplication?

自闭症网瘾萝莉.ら 提交于 2019-12-03 02:10:46
问题 I am trying to figure out the relationship between the appdelegate, RootViewControoler, and UIApplication. Here is what I kinda have figured out so far: When starting your application up, main.m gets loaded. From here, your MainWindow.xib gets loaded. In your MainWindow.xib, your File's Owner is of type UIApplication. You set your UIApplication's delegate to your AppDelegate. In your AppDelegate's source code, you can set your RootViewController to be the first view shown. Is this right? What

UIApplication's -canOpenURL: -openURL: return misleading result

只愿长相守 提交于 2019-12-02 20:45:09
Since iOS6, I can't tell whether the application can launch Safari or not. If Safari is restricted on the device (Settings>General>Restrictions), nothing happens when trying to open a URL, and there's no indication of what went wrong: NSURL *url = [NSURL URLWithString:@"http://www.google.com"]; [[UIApplication sharedApplication] canOpenURL:url]; // Returns YES [[UIApplication sharedApplication] openURL:url]; // Returns YES However, Safari does not launch, and the user is left wondering why my buttons are "broken". This seems like a bug to me so I filed a radar #12449905. Is there another way

This app is not allowed to query for scheme XYZ://

三世轮回 提交于 2019-12-02 12:33:05
问题 You might think it's a duplicate question, but it's not, I'm totally aware of all the answers on SO about the canOpenURL and its caveats on iOS 9, but here is my problem: I'm trying to check if an specific app is installed on my device (both developed by me). I have declared the scheme on AppA as: <key>CFBundleURLTypes</key> <array> <dict> <key>CFBundleURLName</key> <string>com.my.company.id</string> <key>CFBundleURLSchemes</key> <array> <string>XYZ</string> </array> </dict> </array> and on

How do I detect touches on UIStatusBar/iPhone

你离开我真会死。 提交于 2019-12-02 04:23:25
问题 I'm trying to detect any touch on the iPhone's UIStatusBar but its not working. I've tried subclassing UIApplication and UIWindow to access it but still nothing. 回答1: Based on Tom's answer, I wrote the code. It works well. - (void)viewDidLoad { [super viewDidLoad]; // required UIScrollView *scrollView = [[UIScrollView alloc] initWithFrame:CGRectZero]; scrollView.delegate = self; scrollView.contentSize = CGSizeMake(0.0f,1.0f); [scrollView setContentOffset:CGPointMake(0.0f,1.0f) animated:NO]; /

App screen snapshot being shown instead of launchScreen during state restoration

两盒软妹~` 提交于 2019-12-01 09:39:11
问题 I encountered this situation where I had added app state restoration APIs for the first time to a new app supporting iOS 9.3 and higher. The state restoration is working fine functionally, but I noticed that it was showing a screen snapshot instead of the LaunchScreen.xib content because of the delay during state restoration. By snapshot I'm referring to the automatic screenshot iOS takes of your apps UI as it goes into the background. If you don't know what app state restoration is, it came