[英]How do I have padding at the bottom of my UITextView like in Mail.app so the text isn't scrunched?
[英]How do I add an email link in my app that works even if the user has uninstalled Mail.app?
我想在我的應用程序中提供一個電子郵件鏈接,以供用戶發送反饋。 我可以使用mailto鏈接,但是如果用戶已卸載Mail.app(內置郵件應用程序),iOS會彈出一個對話框,指出它已被卸載,並告訴用戶如何還原它。
我不希望這種情況發生。 相反,我想使用另一個電子郵件應用程序(例如Gmail或Inbox)(如果存在)。 而且,如果有多個第三方電子郵件應用程序,則用戶應該有一個選擇,而不是該應用程序隨機選擇一個。
我怎么做?
理想情況下,它應與所有應用程序兼容,而不是對特定應用程序進行硬編碼以進行檢查,例如:
if Inbox is installed {
open Inbox
} else if Gmail is installed {
open Gmail
} else if Outlook is installed {
open Outlook
}
...如果用戶使用的不是這三個應用程序,則顯然不起作用。
您將需要為gmail和Outlook添加查詢方案。 然后,您需要檢查您的應用程序是否可以打開它。 如果您的應用程序可以繼續進行,則在其他情況下檢查其他條件。
像這樣..
NSString *gmailmURL = @"googlegmail://";
NSString *outllokURL = @"outlook://";
if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:gmailURL]])
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:gmailmURL]];
else if ([[UIApplication sharedApplication]
canOpenURL:[NSURL URLWithString:outlookURL]])
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:outllokURL]];
您可以通過添加url這樣在gmail中添加更多信息
googlegmail://co?subject=Example&body=ExampleBody
前景也一定有這樣的東西...
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.