ID Verification iOS SDK提供自訂UI顏色、icon表徵圖的介面,開發人員可以通過編寫自訂UI配置,以檔案或JSON資料格式通過傳入setCustomUI介面實現UI的自訂效果。本文為您介紹UI自訂介面說明以及相關的程式碼範例。
部分自訂配置可能需要依賴SDK升級,建議您在使用之前將SDK升級至最新版本。如使用者介面自訂設定與驗證介面的擴充參數存在衝突,優先使用使用者介面自訂設定。請確保 UI 自訂設定優先於任何驗證介面參數,以提供一致且直觀的使用者體驗。
介面說明
介面定義
iOS SDK中提供了自訂UI顏色和icon表徵圖的介面:setCustomUI。您可以通過調用此方法並傳入對應參數來實現自訂UI的效果。
/**
* 設定自訂UI顏色和icon表徵圖
*
* Set custom UI
* @param configuration - Input JSON string
* @param completeBlock - Callback for the configuration results
*/
- (void)setCustomUI:(nonnull NSString *)configuration
complete:(void(^_Nullable)(BOOL success, NSError * _Nullable error))completeBlock;入參說明
名稱 | 類型 | 說明 |
configuration | NSString | 配置自訂UI傳入JSON字串。 |
completeBlock | block | 結果資訊回調:
|
範例程式碼
NSString *jsonString = @"{\"faceConfig\":{\"exitIconBase64\":\"data:image/png;base64,iVBORw0..\"}}";
[[AliyunIdentityPlatform sharedInstance] setCustomUI:@"" complete:^(BOOL success, NSError * _Nullable error) {
NSLog(@"%@",error.localizedDescription);
}];自訂UI配置內容
完整配置樣本
{
"faceConfig": {
"exitIconBase64": "exit_icon_base64",
"faceBGColor": "#FFFFFF",
"faceTitleColor": "#000000",
"faceTipColor": "#000000",
"opFailedTitleColor": "#000000",
"opFailedTipColor": "#000000",
"opFailedConfirmColor": "#4FA3EC",
"faceProgressEndColor": "#E3824C",
"exitAlertTitleColor": "#000000",
"exitAlertMessageColor": "#000000",
"exitAlertCancelColor": "#4FA3EC",
"exitAlertConfirmationColor": "#4FA3EC",
"timeoutAlertTitleColor": "#000000",
"timeoutAlertMessageColor": "#000000",
"timeoutAlertConfirmationColor": "#4FA3EC",
"tooManyRetriesAlertTitleColor": "#000000",
"tooManyRetriesAlertMessageColor": "#000000",
"tooManyRetriesAlertConfirmColor": "#4FA3EC",
"interruptedAlertTitleColor": "#000000",
"interruptedAlertMessageColor": "#000000",
"interruptedAlertConfirmColor": "#4FA3EC",
"permissionFailedAlertTitleColor": "#000000",
"permissionFailedAlertMessageColor": "#000000",
"permissionFailedAlertConfirmColor": "#4FA3EC",
"verifyNetworkErrorAlertTitleColor": "#000000",
"verifyNetworkErrorAlertMessageColor": "#000000",
"verifyNetworkErrorAlertConfirmColor": "#4FA3EC",
"verifyNetworkErrorAlertCancelColor": "#4FA3EC",
"verifyLoadingColor": "#585858"
},
"ocrConfig": {
"exitIconBase64": "exit_icon_base64",
"albumBase64": "album_base64",
"takePhotoBase64": "take_photo_base64",
"submitBase64": "submit_base64",
"ocrResultExitIconBase64": "ocr_result_exit_icon_base64",
"ocrResultTipIconBase64": "ocr_result_tip_icon_base64",
"ocrTitleColor": "#FFFFFF",
"ocrBorderColor": "#E3824C",
"ocrSubmitTitleColor": "#FFFFFF",
"ocrLoadingColor": "#FFFFFF",
"failedAlertTitleColor": "#000000",
"failedAlertMessageColor": "#000000",
"failedAlertCancelColor": "#4FA3EC",
"failedAlertConfirmationColor": "#4FA3EC",
"timeoutAlertTitleColor": "#000000",
"timeoutAlertMessageColor": "#000000",
"timeoutAlertConfirmationColor": "#4FA3EC",
"exitAlertTitleColor": "#000000",
"exitAlertCancelColor": "#4FA3EC",
"exitAlertConfirmationColor": "#4FA3EC",
"ocrResultTitleColor": "#000000",
"ocrResultTipBGColor": "#DFDFDF",
"ocrResultTipColor": "#000000",
"ocrResultInfoTitleColor": "#000000",
"ocrResultInfoContentColor": "#F6F6F6",
"ocrResultInfoBorderColor": "#E3824C",
"ocrResultTipTitleColor": "#D59F9E",
"ocrResultErrorTipBGColor": "#F6DAD5",
"ocrResultConfirmBtnDisabledBGColor": "#DADADA",
"ocrResultConfirmBtnDisabledTitleColor": "#FFFFFF",
"ocrResultConfirmBtnEnabledBGColor": "",
"ocrResultConfirmBtnEnabledTitleColor": "#FFFFFF",
"ocrResultExitAlertTitleColor": "#000000",
"ocrResultExitAlertCancelColor": "#000000",
"ocrResultExitAlertConfirmationColor": "#4FA3EC",
"restrictionsAlertTitleColor": "#000000",
"restrictionsAlertMessageColor": "#000000",
"restrictionsAlertConfirmationColor": "#4FA3EC",
"permissionFailedAlertTitleColor": "#000000",
"permissionFailedAlertMessageColor": "#000000",
"permissionFailedAlertConfirmColor": "#4FA3EC",
"ocrNetworkErrorAlertTitleColor": "#000000",
"ocrNetworkErrorAlertMessageColor": "#000000",
"ocrNetworkErrorAlertCancelColor": "#4FA3EC",
"ocrNetworkErrorAlertConfirmColor": "#4FA3EC",
"docErrorAlertTitleColor": "#000000",
"docErrorAlertMessageColor": "#000000",
"docErrorAlertCancelColor": "#4FA3EC",
"docErrorAlertConfirmColor": "#4FA3EC",
"ocrResultNetworkErrorAlertTitleColor": "#000000",
"ocrResultNetworkErrorAlertMessageColor": "#000000",
"ocrResultNetworkErrorAlertConfirmColor": "#4FA3EC",
"ocrResultInfoErrorAlertMessageColor": "#000000",
"ocrResultInfoErrorAlertConfirmColor": "#4FA3EC",
"ocrResultLoadingColor": "#FFFFFF"
}
}欄位配置效果
faceModule
faceBGColor
| exitIconBase64
| faceTitleColor
|
faceTipColor
| interruptedAlertTitleColor
| interruptedAlertMessageColor
|
interruptedAlertConfirmColor
| permissionFailedAlertTitleColor
| permissionFailedAlertMessageColor
|
permissionFailedAlertConfirmColor
| tooManyRetriesAlertTitleColor
| tooManyRetriesAlertMessageColor
|
tooManyRetriesAlertConfirmColor
| faceProgressEndColor
| exitAlertTitleColor
|
exitAlertMessageColor
| exitAlertCancelColor
| exitAlertConfirmationColor
|
timeoutAlertTitleColor
| timeoutAlertMessageColor
| timeoutAlertConfirmationColor
|
verifyLoadingColor
| verifyNetworkErrorAlertTitleColor
| verifyNetworkErrorAlertMessageColor
|
verifyNetworkErrorAlertCancelColor
| verifyNetworkErrorAlertConfirmColor
|
ocrModule
exitIconBase64 | ocrTitleColor | ocrBorderColor |
albumBase64 | takePhotoBase64 | submitBase64 |
ocrSubmitTitleColor | ocrLoadingColor | ocrNetworkErrorAlertTitleColor |
ocrNetworkErrorAlertMessageColor | ocrNetworkErrorAlertCancelColor | ocrNetworkErrorAlertConfirmColor |
permissionFailedAlertTitleColor | permissionFailedAlertMessageColor | permissionFailedAlertConfirmColor |
docErrorAlertTitleColor | docErrorAlertMessageColor | docErrorAlertCancelColor |
docErrorAlertConfirmColor | failedAlertTitleColor | failedAlertMessageColor |
failedAlertConfirmationColor | failedAlertCancelColor | restrictionsAlertTitleColor |
restrictionsAlertMessageColor | restrictionsAlertConfirmationColor | timeoutAlertTitleColor |
timeoutAlertMessageColor | timeoutAlertConfirmationColor | exitAlertTitleColor |
exitAlertCancelColor | exitAlertConfirmationColor | ocrResultExitIconBase64 |
ocrResultTitleColor | ocrResultTipBGColor | ocrResultTipColor |
ocrResultInfoTitleColor | ocrResultInfoContentColor | ocrResultConfirmBtnEnabledBGColor |
ocrResultConfirmBtnEnabledTitleColor | ocrResultTipTitleColor | ocrResultTipIconBase64 |
ocrResultErrorTipBGColor | ocrResultInfoborderColor | ocrResultConfirmBtnDisabledBGColor |
ocrResultConfirmBtnDisabledTitleColor | ocrResultExitAlertTitleColor | ocrResultExitAlertCancelColor |
ocrResultExitAlertConfirmationColor | ocrResultNetworkErrorAlertTitleColor | ocrResultNetworkErrorAlertMessageColor |
ocrResultNetworkErrorAlertConfirmColor | ocrResultInfoErrorAlertMessageColor | ocrResultInfoErrorAlertConfirmColor |
ocrResultLoadingColor | ocrGuideExitIconBase64 | ocrGuideTitleColor |
ocrGuideContentColor | ocrGuideStartBtnTextColor | ocrGuideStartBtnBGColor |
ocrGuideIndicatorUnSelectedColor | ocrGuideIndicatorSelectedColor | nfcTitleColor |
nfcContentColor | nfcConfirmBtnBGColor | nfcConfirmBtnTextColor |
nfcInputCheckAlertMessageColor | nfcInputCheckAlertConfirmColor | nfcInputPassportEditHintColor |
nfcInputBirthdayEditHintColor | nfcInputValidityEditHintColor | nfcInputPassportLabelColor |
nfcInputBirthdayLabelColor | nfcInputValidityLabelColor | nfcInputBirthdayEditColor |
nfcInputValidityEditColor | nfcInputPassportEditColor | nfcInputTitleColor |
nfcInputBackAlertTitleColor | nfcInputBackAlertCancelColor | nfcInputBackAlertConfirmColor |
nfcInputNextBtnTextSelectColor | nfcInputNextBtnBGSelectColor | nfcReadBackAlertTitleColor |
nfcReadBackAlertConfirmColor | nfcReadBackAlertCancelColor | ocrAlbumLabelColor |
ocrTakePhotoLabelColor |

















































































































