swift 跳到系统设置界面

前端之家收集整理的这篇文章主要介绍了swift 跳到系统设置界面前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。


首先需要设置一下:


跳转到系统的设置页主页,在iOS8.0的时候,Apple出了这么个玩意UIApplicationOpenSettingsURLString,可以跳转到系统设置主页

let settingUrl = NSURL(string: UIApplicationOpenSettingsURLString)!
 if UIApplication.sharedApplication().canOpenURL(settingUrl)
  {
         UIApplication.sharedApplication().openURL(settingUrl)
 }
跳转到其他设置页(以下皆copy自),只需要修改上面代码的目标URL即可Stack OverFlow
例如
About — prefs:root=General&path=About  
Accessibility — prefs:root=General&path=ACCESSIBILITY  
Airplane Mode On — prefs:root=AIRPLANE_MODE  
Auto-Lock — prefs:root=General&path=AUTOLOCK Brightness — prefs:root=Brightness Bluetooth — prefs:root=General&path=Bluetooth Date & Time — prefs:root=General&path=DATE_AND_TIME FaceTime — prefs:root=FACETIME General — prefs:root=General Keyboard — prefs:root=General&path=Keyboard iCloud — prefs:root=CASTLE iCloud Storage & Backup — prefs:root=CASTLE&path=STORAGE_AND_BACKUP International — prefs:root=General&path=INTERNATIONAL Location Services — prefs:root=LOCATION_SERVICES Music — prefs:root=MUSIC Music Equalizer — prefs:root=MUSIC&path=EQ Music 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=STORE Twitter — prefs:root=TWITTER Usage — prefs:root=General&path=USAGE VPN — prefs:root=General&path=Network/VPN Wallpaper — prefs:root=Wallpaper Wi-Fi — prefs:root=WIFI Setting —prefs:root=INTERNET_TETHERING
尽量用真机进行测试,模拟器很多地方你是跳不过去的...我测试了,iOS8.4(iphone5),iOS9.0(iphone6),iOS9.1(iphone5s),iOS9.2(iphone5s),跳转都是正常的. iOS5.1到iOS7貌似是不行的,这个我没测试,有兴趣的同学可以试一试,告诉我结果. 谢谢...


参考:

http://www.jianshu.com/p/580d84dda738

http://www.jianshu.com/p/8e354e684e8a

原文链接:https://www.f2er.com/swift/322754.html

猜你在找的Swift相关文章