
IOS
appiox8
这个作者很懒,什么都没留下…
展开
-
IOS GCD Swift3.0
@IBAction func btn1(_ sender: Any) { label1.text = "线程开启!" //GCD swift_3.0 DispatchQueue.global().async { //sub thread code sleep( 5 )原创 2017-05-21 22:13:18 · 292 阅读 · 0 评论 -
IOS基础控件 Layer swift3.1
//// ViewController.swift// Layer//// Created by hong wang on 2017/6/2.// Copyright © 2017年 appio. All rights reserved.//import UIKitclass ViewController: UIViewController原创 2017-06-03 01:00:53 · 417 阅读 · 0 评论 -
IOS基础控件 UISwitch swift3.1
//// ViewController.swift// uiSwitch//// Created by hong wang on 2017/6/2.// Copyright © 2017年 appio. All rights reserved.//import UIKitclass ViewController: UIViewControll原创 2017-06-03 01:50:18 · 614 阅读 · 0 评论 -
IOS Swift3.1 打印视图生命周期
import UIKitclass ViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, typically from a原创 2017-06-07 18:01:44 · 371 阅读 · 0 评论 -
IOS swift3.1 创建Swift空工程(无storyBoard)纯代码方式编写APP
1.新建工程2找到工程的TAGETS/General/Deployment Info 如下图,删除Main。.3.删除Main.storyboard,选择“Move to Trash"( 这里不需要删除info.plist中的 Main storyboard file base name项,已经不在了)4. 在AppDelegate.原创 2017-06-04 02:17:54 · 1647 阅读 · 0 评论 -
IOS Swift3.0 获取导航栏跟状态栏的高度
print( UIApplication.shared.statusBarFrame.width, UIApplication.shared.statusBarFrame.height )原创 2017-05-25 19:57:49 · 7685 阅读 · 0 评论 -
IOS Swift3.0 URLSession和Json解析
@IBAction func btn2(_ sender: Any) {//post let StrUrl = "http://appio.cn/WebTest/LoginCheck" //访问url let StrBody = "username=admin&password=1234" //post提交数据 let postNSD原创 2017-05-25 16:56:51 · 1307 阅读 · 0 评论 -
IOS Swift3.0 URLSessionTask get/post
@IBAction func btn1(_ sender: Any) {//get let urlString = "http://appio.cn/WebTest/LoginTest.jsp" let url = URL(string:urlString) //创建请求对象 let request = URLRequ原创 2017-05-24 21:35:49 · 405 阅读 · 0 评论 -
IOS Swift3.1 打印系统所有字体
func PrintFonts() { let familyNames = UIFont.familyNames var index:Int = 0 for familyName in familyNames { let fontNames = UIFont.fontNames(f原创 2017-06-09 19:45:50 · 1051 阅读 · 0 评论 -
IOS Swift3.1 获得文本宽度
func getStringRect(text:String, font:UIFont) -> CGRect { let nsText: NSString = NSString( string: text ) let size:CGSize = CGSize(width: UIScreen.main.bounds.width, height: 0)原创 2017-06-09 23:26:25 · 893 阅读 · 0 评论 -
IOS基础控件 UIImageView swift3.1
//// ViewController.swift// UIImageView//// Created by hong wang on 2017/6/2.// Copyright © 2017年 appio. All rights reserved.//import UIKitclass ViewController: UIViewContr原创 2017-06-02 22:22:44 · 396 阅读 · 0 评论 -
IOS基础控件 UIButton swift3.1
//// ViewController.swift// UIButton//// Created by hong wang on 2017/6/1.// Copyright © 2017年 appio. All rights reserved.//import UIKitclass ViewController: UIViewControll原创 2017-06-02 16:38:02 · 887 阅读 · 0 评论 -
IOS Swift 3.0 NSData与String相互转化
var testString = "This is a test string"var nsdata = testString.data(using: String.Encoding.utf8)//NSData 类型var strdata = String(data: nsdata !, encoding: String.Encoding.utf8) as String!//String原创 2017-05-24 20:23:15 · 1940 阅读 · 0 评论 -
IOS Swift3.0 UiView Demo1
import UIKitclass ViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, typically fro原创 2017-05-25 19:56:55 · 593 阅读 · 0 评论 -
IOS Swift3 基本图形绘制
import UIKitclass ViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, typically fro原创 2017-05-26 23:41:33 · 3223 阅读 · 2 评论 -
IOS Swift3.1保存数据
1. 配置文件内数据//读取 let b:String = UserDefaults.standard.string(forKey: "abc")! print( b )//写入UserDefaults.standard.setValue("123", forKey: "abc")2. 全局数据,利用AppDelegate单实例特性原创 2017-06-05 12:22:46 · 348 阅读 · 0 评论 -
IOS Swift3.1 手工代码编写主视图
1. 普通页面控制器func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { // Override point for customization af原创 2017-06-06 11:59:01 · 369 阅读 · 0 评论 -
IOS Swift3.1 手动页面跳转
//跳转self.present(Page1_Spash(), animated: false, completion: nil)//返回self.dismiss(animated: false, completion: nil)原创 2017-06-04 22:33:35 · 1585 阅读 · 0 评论 -
IOS基础控件 UILabel swift3.1
//// ViewController.swift// UILabel//// Created by hong wang on 2017/6/1.// Copyright © 2017年 appio. All rights reserved.//import UIKitclass ViewController: UIViewControlle原创 2017-06-02 01:09:06 · 361 阅读 · 0 评论 -
IOS Swift3.1打印所有已经加载的viewcontroller
var topVC = UIApplication.shared.keyWindow?.rootViewController while topVC != nil { print( topVC! ) topVC = topVC?.presentedViewController }原创 2017-06-06 16:46:10 · 350 阅读 · 0 评论 -
IOS Swift3.1 删除UIViewController
在某些情况下,我们需要删除VC,比如自定义的 启动画面后面一个登陆界面,这样这两个界面在等陆后就不再使用了。 class VC1: UIViewController { override func viewDidLoad() { super.viewDidLoad() let lab :UILabel = UILabel(fra原创 2017-06-06 14:37:33 · 916 阅读 · 0 评论 -
IOS Swift3.1 界面中画定位线
//使用百分比画横线 func setHLine(pos:CGFloat) { let rLinePos:CGFloat = pos * UIScreen.main.bounds.height let line: UIView = UIView(frame: CGRect(x: 0, y: Int(rLinePos), width: Int(UIScr原创 2017-06-10 13:26:18 · 322 阅读 · 0 评论