<iOS何星星>许多新手会犯一些低级错误, 归根到底是基础差, 导致一些很低级的错误.
#1
Set方法里不能再用self.(要set的变量) 先写 _xxx=xxx
-(
void
)setImagesArr:(
NSArray
*)imagesArr{
_imagesArr =imagesArr; <--------
用Set方法 记住一定先写这句
里面不能再用self.imagsArr会造成循环
…..
}
#2
加载自定义View(有xib时) 用NSBundle 不要再傻傻的用alloc init 了!
View_one *view =[[[NSBundlemainBundle] loadNibNamed:@"View_one"owner:self options:nil] lastObject];
#3
记住这个错误 Multiple methods named ‘bounds’ found with …...
这里错的原因是 不知道数组里装的什么 所以直接bounds 错了
解决方案: 1.前面声明一个数组里的对象 接一下 然后再bounds UITextField *tf =self.TFarr[i]; 然后再用 tf.bounds
2.强转一下 告诉编译器这个数组里装的是TextField ————> (
(
UITextField
*)
self
.
TFarr
[i]
bounds )
#4
自己创建的Xib忘记关联
错误: '-[UIViewController _loadViewFromNibNamed:bundle:] loaded the "XXXView" nib but the view outlet was not set.'
没有做nib文件到xxxViewControler程序的关联:
1, 打开nib文件
2, 点击"File's Owner", 按command+4,设置Class为xxxViewControler
3, 按Control+"Files's Owner", 里面有个默认的IBOutlet变量view, 看一下后面有没有做关联,如果没有就拉到下面的View和视图做个关联
重点!
自己创建的非控制器(Controller) 比如自定义Cell的Xib也要关联, 但是要如图关联 千万不要File’s Owner关联
如果错误关联情况下 连线了控件 要重新关联,重新连线
#5
Button 设置title
用Set方法 [myBtn setTitle:@“btnnn” forState:UIControllerStateNomal];
用myBtn.titleText.text =@“不管用”!
#6 一个证书错误
No matching provisioning profiles found: This product type must be built using a provisioning profile, however no provisioning profile matching both the identity “iPhone Developer: He Zhiming (5BYJ69XZ6C)” and the bundle identifier “com.dq.Ziker” was found.
解决方案:再搞一个配置文件 如何搞配置文件——>查看笔记--关于证书
#7 一个Cocopod问题: C
lone下来的代码发现所有库都不能用 只要重新把所有库倒入一遍就行
错误样子大概是
…/.. / POP.h
解决方法
打开终端 进入到项目(cd 项目位置)
再输入 pod install --verbose --no-repo-update 回车 搞定