1.button按鈕修改文字閃爍問題
btn.titleLabel.text = @"111";//避免按鈕閃動(dòng)
[btn setTitle:@"111" forState:UIControlStateNormal];
2.TextView鏈接顏色修改問題
self.privacyTextV.linkTextAttributes = @{NSForegroundColorAttributeName:Color(250, 175, 40)};
3.自定義控件可在xib上使用
- (void)awakeFromNib {
[super awakeFromNib];
//custom code
}
4.鍵盤刪除事件
//自定義TextField 重寫deleteBackward方法
- (void)deleteBackward
{
[super deleteBackward];
//
}
5.enable和userInteraction的區(qū)別
-
enable
對應(yīng)UIControlStateDisabled
狀態(tài)
-
userInteraction
只對應(yīng)交互性
`
6.connerstone add所有文件
- 使用import
- svn add * --force
7.collectionView的Item的間距
- minimumInteritemSpacing表示 同一個(gè)section內(nèi)部間item的 和滾動(dòng)方向垂直方向的間距;
- minimumLineSpacing指的是同一個(gè)section 內(nèi)部 item 的滾動(dòng)方向的間距;
8.cell分割線偏移
if ([self.myTableView respondsToSelector:@selector(setSeparatorInset:)]) {
[self.myTableView setSeparatorInset:UIEdgeInsetsMake(0, 15, 0, 0)];
}
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath {
// 分割線去掉左邊15個(gè)像素
if ([cell respondsToSelector:@selector(setSeparatorInset:)]) {
[cell setSeparatorInset:UIEdgeInsetsZero];
}
if ([cell respondsToSelector:@selector(setLayoutMargins:)]) {
[cell setLayoutMargins:UIEdgeInsetsZero];
}
}
9.imagePicker導(dǎo)航欄
_imagePicker.navigationBar.tintColor = [UIColor whiteColor];
_imagePicker.navigationBar.backgroundColor = [UIColor lt_hexStringToColor:@"#002A4C"];
// 設(shè)置字體顏色
NSMutableDictionary *attrs = [NSMutableDictionary dictionary];
attrs[NSForegroundColorAttributeName] = [UIColor whiteColor];
[_imagePicker.navigationBar setTitleTextAttributes:attrs];
10.Xcode不自動(dòng)不全
1.退出xcode
2.刪除deriveData文件夾( ~/Library/Developer/Xcode/DerivedData)
3.刪除com.apple.dt.Xcode文件(~/Library/Caches/com.apple.dt.Xcode)
11.Library not loaded: /usr/lib/libstdc++.6
真機(jī):/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/lib/libstdc++.6.0.9.tbd
模擬器:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libstdc++.6.0.9.dylib
12.iOS 時(shí)間格式化
G: 公元時(shí)代,例如AD公元
yy: 年的后2位
yyyy: 完整年
MM: 月,顯示為1-12,帶前置0
MMM: 月,顯示為英文月份簡寫,如 Jan
MMMM: 月,顯示為英文月份全稱,如 Janualy
dd: 日,2位數(shù)表示,如02
d: 日,1-2位顯示,如2,無前置0
EEE: 簡寫星期幾,如Sun
EEEE: 全寫星期幾,如Sunday
aa: 上下午,AM/PM
H: 時(shí),24小時(shí)制,0-23
HH: 時(shí),24小時(shí)制,帶前置0
h: 時(shí),12小時(shí)制,無前置0
hh: 時(shí),12小時(shí)制,帶前置0
m: 分,1-2位
mm: 分,2位,帶前置0
s: 秒,1-2位
ss: 秒,2位,帶前置0
S: 毫秒
Z: GMT(時(shí)區(qū))
iOS 13.collectionViewCell重寫select
override var isSelected: Bool {
willSet {
if newValue {
}else{
}
}
}
14.xib動(dòng)畫
self.inputViewBottomCon.constant = 40
UIView.animate(withDuration: duration, animations: {
self.view.layoutIfNeeded()
})
15.主線程刷新UI
swift:
DispatchQueue.main.async {
//刷新UI
}
OC:
dispatch_async(dispatch_get_main_queue(), ^{
// UI更新代碼
});