有時(shí)候,我們希望用戶跳轉(zhuǎn)到設(shè)置界面,進(jìn)行一些設(shè)置。這個(gè)時(shí)候該如何跳轉(zhuǎn)呢?
- iOS8下跳轉(zhuǎn)到設(shè)置界面方式:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];
注:這種方式雖然能跳轉(zhuǎn)到設(shè)置界面,但是不能跳轉(zhuǎn)到具體的頁(yè)面
- 如何跳到指定的設(shè)置界面,例如設(shè)置WiFi的時(shí)候,想直接跳到WiFi設(shè)置界面。
在URL Types添加 一個(gè)叫prefs的URL Schemes
"prefs"這個(gè)Schemes原本是系統(tǒng)自帶的,xcode5.0后取消了,需要自己加
如圖:

在適當(dāng)?shù)臅r(shí)候,調(diào)用此方法跳轉(zhuǎn)到對(duì)應(yīng)的設(shè)置界面
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"跳轉(zhuǎn)不同界面對(duì)應(yīng)的URLString"]];
詳見如下:
蜂窩網(wǎng)絡(luò):prefs:root=MOBILE_DATA_SETTINGS_ID
VPN — prefs:root=General&path=Network/VPN
Wi-Fi:prefs:root=WIFI
定位服務(wù):prefs:root=LOCATION_SERVICES
個(gè)人熱點(diǎn):prefs:root=INTERNET_TETHERING
關(guān)于本機(jī):prefs:root=General&path=About
輔助功能:prefs:root=General&path=ACCESSIBILITY
飛行模式:prefs:root=AIRPLANE_MODE
鎖定:prefs:root=General&path=AUTOLOCK
亮度:prefs:root=Brightness
藍(lán)牙:prefs:root=General&path=Bluetooth
時(shí)間設(shè)置:prefs:root=General&path=DATE_AND_TIME
FaceTime:prefs:root=FACETIME
設(shè)置:prefs:root=General
鍵盤設(shè)置:prefs:root=General&path=Keyboard
iCloud:prefs:root=CASTLEiCloud
備份:prefs:root=CASTLE&path=STORAGE_AND_BACKUP
語(yǔ)言:prefs:root=General&path=INTERNATIONAL
定位:prefs:root=LOCATION_SERVICES
音樂:prefs:root=MUSICMusic
Equalizer — prefs:root=MUSIC&path=EQMusic
Volume Limit — prefs:root=MUSIC&path=VolumeLimit
Network — prefs:root=General&path=Network
Nike + iPod — prefs:root=NIKE_PLUS_IPOD
Notes — prefs:root=NOTES
Notification — prefs:root=NOTIFICATIONS_ID
Phone — prefs:root=Phone
Photos — prefs:root=Photos
Profile —prefs:root=General&path=ManagedConfigurationList
Reset — prefs:root=General&path=Reset
Safari — prefs:root=Safari
Siri — prefs:root=General&path=Assistant
Sounds — prefs:root=Sounds
Software Update —prefs:root=General&path=SOFTWARE_UPDATE_LINK
Store — prefs:root=STORET
witter — prefs:root=TWITTER
Usage — prefs:root=General&path=USAGE
Wallpaper — prefs:root=Wallpaper
3.如果需要直接跳轉(zhuǎn)到APP對(duì)應(yīng)的設(shè)置界面
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root=Bundle identifier"]];
可以直接打開對(duì)應(yīng)App的設(shè)置頁(yè)面