iOS错误解决

来源:互联网 发布:java web service教程 编辑:程序博客网 时间:2024/05/17 02:35

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.

上面这个例子省略了@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 resultparameter 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;

 


0 0