Tools & releasesHistorical technical note
Disabling and dimming third-party sign-in buttons when the app is not installed
Uses QQ and WeChat sign-in buttons to show how installation checks can determine whether a button is hidden, disabled or dimmed. It records the interface treatment used when the corresponding third-party app was unavailable.
The original does not clearly identify an author. Retained as a historical article.
On this page
Apple recently introduced a review rule against directing users to install third-party software, so third-party login should not prompt users that the app is missing. The best approach is to hide the option or disable it and gray it out. Put the following code in the login view controller's viewDidLoad method. The commented-out section hides the icons. These examples mainly cover QQ and WeChat.
// Check whether the app for third-party login is installed; if not, disable its icon and make it gray
- (void)isHidenThirdBtn
{
BOOL WXinstalled = [WXApi isWXAppInstalled];
BOOL QQinstalled = [TencentOAuth iphoneQQInstalled];
// [WeiboSDK isWeiboAppInstalled]
if (!WXinstalled && !QQinstalled) {
// self.WeiBoBtn.center = self.WeiXinBtn.center;
// self.WeiBoLa.center = self.WeiXinLa.center;
self.WeiXinBtn.enabled = NO;
// self.WeiXinLa.hidden = YES;
self.QQBtn.enabled = NO;
// self.QQLa.hidden = YES;
}
if (!WXinstalled && QQinstalled) {
// self.WeiXinBtn.hidden = YES;
self.WeiXinBtn.enabled = NO;
// self.WeiXinLa.hidden = YES;
}
if (WXinstalled && !QQinstalled) {
// self.WeiXinBtn.center = self.QQBtn.center;
// self.WeiXinLa.center = self.QQLa.center;
self.QQBtn.enabled = NO;
// self.QQLa.hidden = YES;
}
}