1.touchesShouldBegin:html
// 在UIScrollView的子類中重寫該方法,用於返回是否將事件傳遞給對應的子視圖,默認返回YES,若是返回NO,該事件不會傳遞給對應的子視圖git
- (BOOL)touchesShouldBegin:(NSSet<uitouch> *)touches withEvent:(UIEvent *)event inContentView:(UIView *)view;express
UIScrollView處理觸摸事件原理:npm
當用戶在UIScrollView的一個子視圖上按下時,UIScrollView並不知道用戶是想要滑動內容視圖仍是點擊對應子視圖,因此在按下的一瞬間,事件UIEvent從UIApplication傳遞到UIScrollView後,其會先將該事件攔截而不會當即傳遞給對應的子視圖,同時開始一個150ms的倒計時,並監聽用戶接下來的行爲app
當倒計時結束前,若是用戶的手指發生了移動,則直接滾動內容視圖,不會將該事件傳遞給對應的子視圖; 當倒計時結束時,若是用戶的手指位置沒有改變,則調用自身的-touchesShouldBegin:withEvent:inContentView:方法詢問是否將事件傳遞給對應的子視圖(若是返回NO,則該事件不會傳遞給對應的子視圖,若是返回YES,則該事件會傳遞給對應的子視圖,默認爲YES) 當事件被傳遞給子視圖後,若是手指位置又發生了移動,則調用自身的-touchesShouldCancelInContentView:方法詢問是否取消已經傳遞給子視圖的事件.ui
2. intrinsicContentSize使用:this
http://www.javashuo.com/article/p-hjytsicq-eb.html.net
3.報錯Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Source type 1 not available’:htm
緣由是由於使用的模擬器,模擬器不能拍照。blog
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 讓突如其來的分支切換更加美好。