
IOS
Kila_
这个作者很懒,什么都没留下…
展开
-
IOS学习笔记-0001
-只在.m文件中实现而没有在.h文件中定义的方法是私有方法 -系统自带的静态方法一般都是“自动释放”的 -收起键盘 [self.view endEditing:YES] - UIImage *img=[UIImage imageNamed:name];//(有缓存--无法释放,参数传的是文件名)加载图片--有缓存--图片经常用,不需要释放时使用 -[UIIm原创 2014-10-07 15:01:05 · 495 阅读 · 0 评论 -
【iOS(swift)笔记-5】九宫格图片只对Imageview有效
let topBar = UIView() // 这种设置背景图片的方式只会平铺(而且占内存)topBar.backgroundColor = UIColor(patternImage: UIImage(named:"icon_tab_bg")!)// 这种设置背景图片的方式虽然可以拉伸,但是九宫格失效 topBar.layer.contents = UIImage(named:"icon_...原创 2018-02-18 08:30:34 · 431 阅读 · 0 评论 -
【iOS(swift)笔记-7】自定义九宫格图片布局(基于SnapKit)
调用方法:// 我这里是将HxNineGridView添加到UITableViewCell里,你可以将它用在其他地方let nineGridView = HxNineGridView()self.contentView.addSubview(nineGridView) nineGridView.snp.makeConstraints { (make) -> Void i...原创 2018-02-20 21:13:56 · 3530 阅读 · 0 评论 -
【iOS(swift)笔记-6】自定义ObjectMapper的时间转换
ObjectMapper内置的时间转换模式有限,有时候从服务端获取的时间数据不能正常转换,这种时候就需要通过自定义时间转换模式来解决。第1步:实现协议TransformType//// HxDateTransform.swift// App//// Created by kila on 17/02/2018.// Copyright © 2018 kila. All rights rese...原创 2018-02-18 09:05:11 · 2332 阅读 · 0 评论 -
【iOS(swift)笔记-4】Push页面隐藏tabor,Pop回来自动显示tabbar(这样tabbar就不会有从下往上弹出的动作)
先设置hidesBottomBarWhenPushed = true然后紧接着在跳转页面的代码后设置hidesBottomBarWhenPushed = falseself.hidesBottomBarWhenPushed = trueself.navigationController?.pushViewController(LoginViewController(), animated: tru...原创 2018-02-18 08:24:57 · 1077 阅读 · 1 评论 -
【iOS(swift)笔记-3】swift使用SnapKit创建高度自适应的cell方法
//// BlogTableViewCell.swift// App//// Created by kila on 16/02/2018.// Copyright © 2018 kila. All rights reserved.//import UIKit// 自定义cell类class MyTableViewCell: UITableViewCell { var uImg...原创 2018-02-17 14:34:58 · 1791 阅读 · 0 评论 -
【iOS(swift)笔记-2】iOS MVP总结
【M】DataModel 服务端数据或本地数据对应的实体类【M】Service(这里也可以先抽象出ServiceProtocol然后Service继承ServiceProtocol实现其抽象方法,则Presenter持有的是ServiceProtocol实例)请求本地或服务端数据【M】ServiceListener针对Service请求的回调监听,监听也是Protocol,需要...原创 2017-12-23 22:17:14 · 247 阅读 · 0 评论 -
【iOS(swift)笔记-1】使用Cocoapods安装Alamofire
https://boxueio.com/series/alamofire-tutorials/ebook/44如何使用pod 'AlamofireObjectMapper', '~> 5.0'则不仅会导入 AlamofireObjectMapper也会 导入 Alamofirehttps://github.com/tristanhimmelman/AlamofireObjectMapper...转载 2017-12-14 09:58:28 · 604 阅读 · 0 评论 -
【iOS笔记-异常-1】
Failed to initiate service connection to simulator Error returned in reply: Connection invalid 关闭所有xcode和模拟器,重新运行即可正常。原创 2017-12-15 20:40:53 · 330 阅读 · 0 评论 -
【iOS(swift)笔记-8】SnapKit布局ScrollView时注意点
// 注意!这里必须要设置子视图(这里是uView)的宽度和高度,而且子视图上下左右边缘要设置和父视图对齐,这样父视图ScrollView的contentSize才会自动得到同等的值。否则只能手动设置,例如 ScrollView.contentSize = CGSize(width: 300, height: 900) uView.snp.updateConstraints { (m...原创 2018-04-04 08:25:19 · 1450 阅读 · 0 评论