UI進階 跳轉系統設定相關介面的方法,ui進階
跳轉系統設定介面,例如提示使用者開啟定位、藍芽或者WIFI,提醒使用者開啟推送或者位置許可權等
在iOS6之後,第三方應用需要跳轉系統設定介面,需要在URL type中添加一個prefs值,如:
跳轉系統設定根目錄中的項目使用下面的方法
1 _array = @[ 2 @{@"系統設定":@"prefs:root=INTERNET_TETHERING"}, 3 @{@"WIFI設定":@"prefs:root=WIFI"}, 4 @{@"藍芽設定":@"prefs:root=Bluetooth"}, 5 @{@"系統通知":@"prefs:root=NOTIFICATIONS_ID"}, 6 @{@"通用設定":@"prefs:root=General"}, 7 @{@"顯示設定":@"prefs:root=DISPLAY&BRIGHTNESS"}, 8 @{@"壁紙設定":@"prefs:root=Wallpaper"}, 9 @{@"聲音設定":@"prefs:root=Sounds"},10 @{@"隱私權設定":@"prefs:root=privacy"},11 @{@"APP Store":@"prefs:root=STORE"},12 @{@"Notes":@"prefs:root=NOTES"},13 @{@"Safari":@"prefs:root=Safari"},14 @{@"Music":@"prefs:root=MUSIC"},15 @{@"photo":@"prefs:root=Photos"}16 ];17 NSURL * url = [NSURL URLWithString:[_array[index] allValues].firstObject];18 [[UIApplication sharedApplication]openURL:url];
如果要跳轉第三方應用的設定介面中,使用prefs:root=boundleId的方式,boundleId是第三方應用的boundleId。
如果需要繼續向項目內層進行跳轉,可以通過添加path路徑的方式,如下:
1 _array = @[ 2 @{@"關於本機":@"prefs:root=General&path=About"}, 3 @{@"軟體升級":@"prefs:root=General&path=SOFTWARE_UPDATE_LINK"}, 4 @{@"日期時間":@"prefs:root=General&path=DATE_AND_TIME"}, 5 @{@"Accessibility":@"prefs:root=General&path=ACCESSIBILITY"}, 6 @{@"鍵盤設定":@"prefs:root=General&path=Keyboard"}, 7 @{@"VPN":@"prefs:root=General&path=VPN"}, 8 @{@"壁紙設定":@"prefs:root=Wallpaper"}, 9 @{@"聲音設定":@"prefs:root=Sounds"},10 @{@"隱私權設定":@"prefs:root=privacy"},11 @{@"APP Store":@"prefs:root=STORE"},12 @{@"還原設定":@"prefs:root=General&path=Reset"},13 @{@"應用通知":@"prefs:root=NOTIFICATIONS_ID&path=應用的boundleId"}14 ];