iOS Status Bar touch to return to App

2020-07-11 05:10发布

问题:

This is puzzling me, does anyone have any idea how to go about doing this? The blue glowing status bar as in the image as what the Facebook app does when launching FB Messenger

Sorry bout the huge image!!! Would be great if anyone could point me to the right direction

回答1:

It seems like a custom view that sits on top of the navigation bar with a custom stylised title: Touch to return to facebook. The navigation bar has an action applied to it so that when the user taps the navigation bar, the following code is executed to open the desired application, in this case facebook.

It uses the iPhone url scheme, whereby you can open up an application on the device directly from your app if the user has the application installed.

like this:

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"fb:]];
//and instead of fb: if you'd want it to open your custom app, 
//you simply add your own scheme instead: like so myappscheme:

To set a scheme for your own app follow the following instructions taken from this site

  1. Defining your app's custom URL scheme is all done in the Info.plist file. Click on the last line in the file and then click the "+" sign off to the right to add a new line. Select URL Types for the new item. Once that's added, click the grey arrow next to "URL Types" to show "Item 0". Set your URL identifier to a unique string - something like com.yourcompany.yourappname.

  2. After you've set the URL identifier, select that line and click the "+" sign again, and add a new item for URL Schemes. Then click the grey arrow next to "URL Schemes" to reveal "Item 0". Set the value for Item 0 to be your URL scheme name.