iPhone SDK - Add a “Add to Home Screen” button in a UIWebView

后端 未结 3 822
南笙
南笙 2020-12-06 07:30

I have a native iPhone app, which has a UIWebView component to it. I am trying to see if I can replicate the \"Add to Home Screen\" button that

3条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-06 07:55

    The short answer is no, you can't. Apple does not let you.

    Here's a similar question which may help you come up with other possibilities: Javascript for "Add to Home Screen" on iPhone?

    If I had to think of a work around off the top of my head, you could create an javascript pop-up which instructs them how to. It could say something like tap this button to go to mobile safari then tap action -> add to home screen.

    Execute the Javascript with UIWebView's method:

    - (NSString *)stringByEvaluatingJavaScriptFromString:(NSString *)script
    

    Hope this helps.

提交回复
热议问题