一、更換啟動閃屏圖時(shí)候,顯示不出來,或者白屏
解決方案:重啟手機(jī),我自己試過很多方案只有這一個(gè)管用。
二、手機(jī)數(shù)據(jù)連接Mac出現(xiàn)斷斷續(xù)續(xù)不停的斷開連接
解決方案:先拔掉數(shù)據(jù)線;打開終端--> 輸入sudo killall -STOP -c usbd 回車輸入密碼就好了;如果沒有拔掉數(shù)據(jù)線并且連著手機(jī),可能會把手機(jī)的連接接口也關(guān)了,這時(shí)就要重啟手機(jī)了
三、swift中tableview想要置頂,包含手機(jī)的狀態(tài)欄。
一般:
tableV.snp.makeConstraints {
$0.left.right.top.bottom.equalTo(self.view)
}
只是這樣的話,tableV會在狀態(tài)欄的下面
還必須加上以下代碼
if #available(iOS 11.0, *) {
tv.contentInsetAdjustmentBehavior = .never
} else {
self.automaticallyAdjustsScrollViewInsets = false
}
四、使用UIBezierPath設(shè)置圓角時(shí),有的時(shí)候回連整個(gè)空間都顯示不出來了
解決方法:主動調(diào)用setNeedDisplay方法,就可以解決
view.setNeedsDisplay()
五、iOS關(guān)閉系統(tǒng)側(cè)滑返回
最接單有效的辦法
let obj = self.navigationController?.interactivePopGestureRecognizer?.delegate
let pan = UIPanGestureRecognizer(target: obj, action: nil)
self.view.addGestureRecognizer(pan)
六、iOS 9.0之后設(shè)置導(dǎo)航欄顏色
在需要改變狀態(tài)欄顏色的ViewController中實(shí)現(xiàn)以下方便即可
- (UIStatusBarStyle)preferredStatusBarStyle{
return UIStatusBarStyleLightContent;
}
如果無效,請往下看:
首先查看info.plist文件中有沒有設(shè)置View controller-based status bar appearance的值為NO,如果設(shè)置了請先改為YES。
其次查看你的項(xiàng)目框架是否是UINavigationController或UITabBarController為容器。如果以UINavigationController為容器則在自定義的UINavigationController中實(shí)現(xiàn)這個(gè)方法
- (UIViewController *)childViewControllerForStatusBarStyle{
return self.topViewController;
}
如果以UITabBarController為容器則在自定義的UITabBarController中實(shí)現(xiàn)這個(gè)方法
- (UIViewController *)childViewControllerForStatusBarStyle{
return self.selectedViewController
}
如果兩個(gè)容器嵌套使用則需分別實(shí)現(xiàn)以上的方法
然后在需要改變狀態(tài)欄顏色的ViewController中實(shí)現(xiàn)以下方便即可
- (UIStatusBarStyle)preferredStatusBarStyle{
return UIStatusBarStyleLightContent;
}
更好建議或意見的同學(xué)可以郵箱聯(lián)系我哦 1147904687@qq.com