随笔分类 - iOS
Xcode - No architectures to compile for ...
摘要:Error: No architectures to compile for (ONLY_ACTIVE_ARCH=YES, active arch=x86_64, VALID_ARCHS=arm64 arm64e, EXCLUDED_ARCHS=( arm64)). Solution: Remove
阅读全文
点击任意位置隐藏键盘
摘要:给view加一个点击事件,点击时收起键盘: override func viewDidLoad() { super.viewDidLoad() let tap = UITapGestureRecognizer(target: self, action: #selector(self.dismissK
阅读全文
UIButton设置按钮点击范围大于可视范围
摘要:自定义按钮类型CustomButton,继承UIButton,重写pointInside函数改变点击响应范围。 例如,按钮点击范围比实际高度上下增加6。 CustomButton.h CustomButton.m
阅读全文
Unknown class xxx in Interface Builder file. / NSUnknownKeyException
摘要:Error: 2019-11-24 22:16:01.047997+0800 SingleViewDemo[22576:34699748] Unknown class FeedbackCell in Interface Builder file. 2019-11-24 22:16:01.058953
阅读全文
可滚动UIStackView 竖向居中 / 横向右对齐
摘要:重点: 在scroll view和stack view之间加一个UIView。 竖向居中Tutorial: https://stackoverflow.com/questions/50766400/center-uiview-vertically-in-scroll-view-when-its-dy
阅读全文
横向滚动的UIStackView
摘要:https://medium.com/@mufakkharulislamnayem/scrolling-in-a-horizontal-uistackview-with-storyboard-e02a9aab555b
阅读全文
Objective-C基础教程 笔记
摘要:一、对C的扩展 1. #import VS #include C语言使用#include语句通知编译器应在头文件中查询定义。 OC中也可以使用#include,但几乎不这么用,而是使用#import。 #import <Foundation/Foundation.h> (查看Foundation框架
阅读全文
判断屏幕方向
摘要:override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) { let deviceOrientation = UIDevice.current.orientation if UIDeviceOrient...
阅读全文
Swift的 convenience && designated init
摘要:http://www.th7.cn/Program/IOS/201603/789227.shtml 在 OC 中 init 方法是非常不安全的,没人能够保证 init 只被调用一次,也没有人保证在初始化方法调用以后实例的各个变量都完成初始化,甚至如果在初始化里使用属性进行设置的的话,还可能会造成各种
阅读全文
xcode报错http
摘要:问题: Xcode项目发送网络请求时,报错:“App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure. Temporary exceptions can be c
阅读全文
本地数据持久化方法
摘要:http://www.jianshu.com/p/86ea6da905cf http://www.cocoachina.com/industry/20130328/5908.html 1. 属性列表(plist)NSUserDefaults 属性列表是一种明文的轻量级存储方式,其存储格式有多种,最常
阅读全文
页面跳转方法
摘要:http://www.tuicool.com/articles/vErQFbf http://blog.csdn.net/liu975450858/article/details/50883601 1. modal模态跳转 presentViewController 2. navigation导航控
阅读全文
iOS面试题
摘要:STAR法则,即为Situation Task Action Result的缩写,具体含义是: Situation: 事情是在什么情况下发生 Task: 你是如何明确你的任务的 Action: 针对这样的情况分析,你采用了什么行动方式 Result: 结果怎样,在这样的情况下你学习到了什么 ~~~d
阅读全文
只能在主线程更改界面
摘要:问题: 在主线程之外的线程更改界面,会报错:This application is modifying the autolayout engine from a background thread, which can lead to engine corruption and weird cras
阅读全文
tableview调用reloadData()之后界面不刷新显示
摘要:解决方法: 查看是否有指定tableView的delegate和datasource。 self.tableView.delegate = self self.tableView.datasource = self
阅读全文
添加文件夹但编译时仍找不到其中的文件
摘要:问题: 在工程中引入文件夹时,添加文件夹但编译时仍找不到其中的文件。此时xcode中文件夹的图标为蓝色,而工程中的文件夹应该为黄色。 解决方法: 引入的时候要选Add new group不要选create reference。否则该文件夹里的内容不会参与编译。
阅读全文
模拟器的tableView的分割线不显示
摘要:只有iOS9和iPhone6 plus模拟器上TableView分割线不会显示。 原因: 由于iPhone6 plus的分辨率较高,开发的时候同常都使用command + 3 或者 command + 4 缩小模拟器显示,这个时候就相当于把plus的分辨率压缩了所以我们会看不到分割线。 解决办法:
阅读全文
swiftlint升级
摘要:~/Opal/iOS/App (mike/lyrics) $ which brew/usr/local/bin/brew~/Opal/iOS/App (mike/lyrics) $ cd /usr/local/bin//usr/local/bin (master) $ git pull origin
阅读全文
浙公网安备 33010602011771号