问题
Are there any usability guidelines around opening a website in safari from an iPhone app?
Example: I have a button in my app, that when tapped takes the user to a website in safari - this closes my app and opens safari.
To me, it seams kinda crappy to do this without warning the user that they are about to exit the app and open safari.
Are there any user guidelines that state how this should be handled? I.e. should you prompt the user and let them know?
I haven't been able to find an official guideline
回答1:
-(void)openSafari
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"test"
message:@"this will open safari, you sure?"
delegate:self cancelButtonTitle:@"no"
otherButtonTitles:@"yes", nil];
[alert show];
}
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
NSString *title = [alertView buttonTitleAtIndex:buttonIndex];
if([title isEqualToString:@"yes"]){
[[UIApplication sharedApplication] openURL:
[NSURL URLWithString:@"http://www.google.com"]];
}
}
in your header file.
@class YourClass : SuperClass<UIAlertViewDelegate>
回答2:
It's better if you load the web on a UIWebView instead opening safari (as twitter, facebook and many other apps do), because the user doesn't leave your app
来源:https://stackoverflow.com/questions/12317595/guidelines-for-opening-safari-from-an-iphone-app