ios
SebastianMichaelis
这个作者很懒,什么都没留下…
展开
-
ios swift UIwebView
//自适应屏幕大小 let webView = UIWebView(frame:self.view.bounds) let urlStr = "http://baidu.com" let url = NSURL(string: urlStr) let request = NSURLRequest(URL: url!)原创 2015-11-03 11:35:56 · 595 阅读 · 0 评论 -
swift 获取AppDelegate对象
let appDelegate = (UIApplication.sharedApplication().delegate) as! AppDelegate原创 2016-01-07 13:19:58 · 6457 阅读 · 0 评论 -
swift 获取idfa
import AdSupportlet idfa = ASIdentifierManager.sharedManager().advertisingIdentifier.UUIDString原创 2016-01-06 14:59:04 · 2189 阅读 · 0 评论 -
ios swift 获取设备型号 版本
这段代码可以获取到具体的设备版本(已更新到iPhone 6s、iPhone 6s Plus), 缺点是:采用的硬编码。具体的对应关系, 其他iPad, iPod等设备可以参考:点击打开链接 https://www.theiphonewiki.com/wiki/Models这段代码使用了C语言中的结构体,但当在Swift中使用历史遗留的C语言库时,我们还是会面临一些问题。参考: 点击打原创 2016-01-19 15:02:52 · 3287 阅读 · 0 评论 -
ios 更多 Url Schemes
蜂窝网络:prefs:root=MOBILE_DATA_SETTINGS_IDVPN — prefs:root=General&path=Network/VPNWi-Fi:prefs:root=WIFI定位服务:prefs:root=LOCATION_SERVICES个人热点:prefs:root=INTERNET_TETHERING关于本机:prefs:root=Genera原创 2016-01-19 10:37:40 · 1756 阅读 · 0 评论 -
ios swift UITabBarController
在AppDelegate中 func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool 方法内 self.window = UIWindow(fram原创 2015-11-04 14:22:12 · 507 阅读 · 0 评论 -
ios swift sha1 md5 加密
在自己的swift类中扩展String方法extension String { //sha1加密算法 func getSha1() -> String { let data = self.dataUsingEncoding(NSUTF8StringEncoding)! var digest = [UInt8](co原创 2015-11-18 16:43:17 · 2386 阅读 · 0 评论 -
iOS swift 通过Url打开自定义的app
在info.plist中代码模式下添加:CFBundleURLTypesCFBundleURLSchemesaaaaaa是自定义的协议在AppDelegate.swift中,重写一个方法//外界启动URL操作 func application(application: UIApplication, handleOpe原创 2015-11-03 14:32:23 · 2733 阅读 · 0 评论 -
ios swift UILabel 颜色使用图片
var myMessage:UILabel myMessage = UILabel(frame: CGRectMake(30,50, 300,50)) myMessage.font =UIFont.systemFontOfSize(48) myMessage.text ="Hello Xcode" myMe原创 2015-11-12 21:31:46 · 940 阅读 · 0 评论 -
ios swift 在弹出框展示图片
let alertController = UIAlertController(title: "\n\n\n\n\n\n\n",message: "\n\n\n\n", preferredStyle: .Alert)//根据图片大小用\n换行符占取位置 let alertAction = UIAlertAction(title: "确认", style:原创 2015-11-12 16:37:26 · 2629 阅读 · 0 评论 -
iphone 设置 开发者 对应的中文翻译
翻译水平与有道机器翻译一致原创 2015-11-11 15:40:02 · 13906 阅读 · 0 评论 -
ios 禁用旋转横屏
原创 2015-11-11 17:08:52 · 745 阅读 · 0 评论 -
ios swift 文件存取
//存储 读取用户识别码class UserIdCode: NSObject { var id = "0b1000000001" func saveId(){ print("存入用户唯一识别码...") var sp = NSSearchPathForDirectoriesInDomains(NSSearc原创 2015-11-05 15:59:22 · 1228 阅读 · 0 评论 -
swift HTTP通讯
IOS现在不建议http通讯 访问任意http请求 在info.plist 中加入NSAppTransportSecurityNSAllowsArbitraryLoadsGET方式:var urlString = "http://localhost:8080/MyServer/hello.jsp?name=\(tvInput.text)"原创 2015-10-30 14:29:29 · 814 阅读 · 2 评论