1.报错IOS fatal error: unexpectedly found nil while unwrapping an Optional value:
一开始以为是关联错了,最后发现时加载错了。
从XIB加载view:
https://blog.csdn.net/callzjy/article/details/65967872
2.Xib画ScrollView:
https://blog.csdn.net/weixin_42521912/article/details/80777498
3.UIImageView上添加collectionView上不能滑动:
imageview默认是userInteractionEnabled 为NO,把他可交互设置为NO; UIView默认为yes,可交互
4.父视图设置Alpha,子视图也会透明:
可以下面这么设置:
self.backgroundColor = UIColor.white.withAlphaComponent(0.150000005960464)
5.Swift XPC connection interrupted -3840‘:
还以为后台挂了,然后用其他的代码访问后台也没事,最后居然切换了一下分支就好了。
6.UITextView实现placeHolder效果:
fileprivate func setupTextView() { if inputTextView.text == GLOBAL_LANGUAGE("请输入您的留言") { inputTextView.text = "" } inputTextView.textColor = UIColor.unityBlackColor() inputTextView.becomeFirstResponder() } } extension MessageController: UITextViewDelegate { func textViewDidBeginEditing(_ textView: UITextView) { setupTextView() } }
7.iOS实时搜索:
if(self.searchTF.text.length >0) { UITextRange*selectedRange = [self.searchTF markedTextRange]; if(!selectedRange) { NSLog(@“调用接口”); }