0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

swift代码

Posted at

1解决bug
看一个方法被调用的次数,可以右键,点击Find Call Hiererarchy;
不要背代码,要执行代码,看问题出现在哪里,然后去解决;
Command + R 运行,发现问题,然后结局问题;
写代码要测试,看有没有数据再往下写;
打断点多用PO;
2编码习惯
Sql 语句在数据库里查好了,再往代码里写;
增强代码的可读性:在参数后面换行。如: vc.tabBarItem.selectedImage = UIImage(named:
"tabbar_" + imageName + "_selected")?
.withRenderingMode(.alwaysOriginal);
3代码规范
最重要的方法放在上面,页面的东西放在下面不常改;
代码优化
封装类的方法:看见重复额的代码,抽取出来,见参数就写参数;
能用颜色的不用背景图片;

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?