七月第四周总结

1.touchesShouldBegin:

// 在UIScrollView的子类中重写该方法,用于返回是否将事件传递给对应的子视图,默认返回YES,如果返回NO,该事件不会传递给对应的子视图

- (BOOL)touchesShouldBegin:(NSSet<uitouch> *)touches withEvent:(UIEvent *)event inContentView:(UIView *)view;

UIScrollView处理触摸事件原理:

当用户在UIScrollView的一个子视图上按下时,UIScrollView并不知道用户是想要滑动内容视图还是点击对应子视图,所以在按下的一瞬间,事件UIEvent从UIApplication传递到UIScrollView后,其会先将该事件拦截而不会立即传递给对应的子视图,同时开始一个150ms的倒计时,并监听用户接下来的行为

当倒计时结束前,如果用户的手指发生了移动,则直接滚动内容视图,不会将该事件传递给对应的子视图; 当倒计时结束时,如果用户的手指位置没有改变,则调用自身的-touchesShouldBegin:withEvent:inContentView:方法询问是否将事件传递给对应的子视图(如果返回NO,则该事件不会传递给对应的子视图,如果返回YES,则该事件会传递给对应的子视图,默认为YES) 当事件被传递给子视图后,如果手指位置又发生了移动,则调用自身的-touchesShouldCancelInContentView:方法询问是否取消已经传递给子视图的事件.

2. intrinsicContentSize使用:

https://www.cnblogs.com/songxing10000/p/6397364.html

3.报错Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Source type 1 not available’:

原因是因为使用的模拟器,模拟器不能拍照。

https://stackoverflow.com/questions/10686401/how-to-solve-this-error-of-terminating-app-due-to-uncaught-exception-nsinvalida

4.npm更新:

$ npm install npm@latest -g 进行npm版本自动更新

5.npm express -e . 报错Express command not found:

sudo npm install -g express-generator

https://stackoverflow.com/questions/22999612/zsh-command-not-found-express

6.正则记录:

let phoneRegex = "^[0-9]\d{7,11}$"     // 8~12位数字

let phoneRegex = "^[0-9]\d{10}$"       // 11位数字

7.git stash的使用:

使用 git stash 让突如其来的分支切换更加美好。

https://blog.csdn.net/qq_32452623/article/details/76100140

原文地址:https://www.cnblogs.com/pengsi/p/9378371.html