iOS错误解决
2016-06-30 11:38
344 查看
1.
解决:tried re-adding files, but have no work. So, I find the .pbxproj file in .xcodeproj, delete rows include the file name, then rebuild, success!
2.
the item height must be less than the height of the UICollectionView minus the section insets top and bottom values, minus the content insets top and bottom values.
ItemSize大于UICollectionView减去上下的间距的值,改:
_layout.sectionInset =UIEdgeInsetsMake(0,10,0,10);
3.textview输入时上下跳动 automaticallyAdjustsScrollViewInsets=NO;
4.
上面这个例子省略了
这是为什么呢?我取得了一个TestCounter的实例,但是我把它转为了id类型,然后用id类型调用了count方法,此时编译器会遍历所有的可见头的count方法,编译器当然会找到多个定义,因为count方法在NSArray,NSSet等等这些类上也有实现,而且我的TestCounter的count方法返回的是一个TestCounter对象,这和NSArray,NSSet等的count方法返回NSUInteger类型不一样,所以编译器会给你一个异常,注意看这个异常描述:
multiple methods named ‘count’ found with mismatched result, parameter type or attributes.
那为什么把NSArray转成id类型调用count方法不会有错呢?因为Foundation框架的所有count方法的返回值都是一个NSUInteger类型,编译器找到的签名自然都是一样的。
如果我们把TestCounter的count的返回值也改成NSUInteger就没事了。
5、
cell自适应高度,
建立label的上下左右约束,line=0.
或者
6.
push下一个界面的时候,上一个界面的控件不能及时消失,
解决:下一个界面添加背景色
7、
单选Button
if(sender!=self.currentBtn){
self.currentBtn.selected=NO;
self.currentBtn=sender;
}
self.currentBtn.selected=YES;
解决:tried re-adding files, but have no work. So, I find the .pbxproj file in .xcodeproj, delete rows include the file name, then rebuild, success!
2.
the item height must be less than the height of the UICollectionView minus the section insets top and bottom values, minus the content insets top and bottom values.
ItemSize大于UICollectionView减去上下的间距的值,改:
_layout.sectionInset =UIEdgeInsetsMake(0,10,0,10);
3.textview输入时上下跳动 automaticallyAdjustsScrollViewInsets=NO;
4.
上面这个例子省略了
@implementation部分,如果运行起来会看到
multiple methods named 'count' found with mismatched result, parameter type or attributes.错误。
这是为什么呢?我取得了一个TestCounter的实例,但是我把它转为了id类型,然后用id类型调用了count方法,此时编译器会遍历所有的可见头的count方法,编译器当然会找到多个定义,因为count方法在NSArray,NSSet等等这些类上也有实现,而且我的TestCounter的count方法返回的是一个TestCounter对象,这和NSArray,NSSet等的count方法返回NSUInteger类型不一样,所以编译器会给你一个异常,注意看这个异常描述:
multiple methods named ‘count’ found with mismatched result, parameter type or attributes.
那为什么把NSArray转成id类型调用count方法不会有错呢?因为Foundation框架的所有count方法的返回值都是一个NSUInteger类型,编译器找到的签名自然都是一样的。
如果我们把TestCounter的count的返回值也改成NSUInteger就没事了。
5、
cell自适应高度,
建立label的上下左右约束,line=0.
或者
6.
push下一个界面的时候,上一个界面的控件不能及时消失,
解决:下一个界面添加背景色
7、
单选Button
if(sender!=self.currentBtn){
self.currentBtn.selected=NO;
self.currentBtn=sender;
}
self.currentBtn.selected=YES;
相关文章推荐
- iOS-私有API与runtime
- 正版ipa加载dylib且正常运行思路
- HTML5新标签video在iOS上默认全屏播放
- iOS 使用动态库(dylib)和动态加载framework
- JS判断客户端是否是iOS或者Android
- xcode添加空模板!@!@--------enuoNew项目2版
- iOS安全些许经验和学习笔记
- iOS 查找plist文件路径读取plist 文件
- iOS查看日志利器 —— socat
- iOS开发-显示发送时间(几分钟前,几小时前,几天前)
- [iOS 系统]系统音频.相册.相机 权限判断
- 解惑——iOS中成员变量和属性区别
- iOS防止用户截屏
- 趣谈iOS运行时之方法调用原理
- iOS设计模式(五) 中介者模式
- 仿猎豹垃圾清理(实现原理+源码)
- iOS开发-post请求向服务器发送json格式数据(数组或字典)
- 让iOS应用直接退出
- iOS 开发 Pch 文件的正确使用
- rn——小心得