iOS 开发 细小知识 小知识 大用处
2019-05-06 本文已影响0人
Wayne_王
1.创建自定义的触摸手势来实现对键盘的隐藏
UITapGestureRecognizer *tapGestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(keyboardHide:)];
//设置成NO表示当前控件响应后会传播到其他控件上,默认为YES
tapGestureRecognizer.cancelsTouchesInView = NO;
2.不足几位前补0
2表示不足几位补字母
int hour = 4;
endHour.text = [NSString stringWithFormat:@"%02d",hour]; 输出04
int hour = 18;
endHour.text = [NSString stringWithFormat:@"%012d",hour]; 输出000000000018