1. 導(dǎo)航欄titleView適配問題
導(dǎo)航欄搜索視圖沒有占滿導(dǎo)航欄 ?iOS11 導(dǎo)航欄上的視圖推薦使用autolayout ?陶缺。所以那些出問題的最好修改一下布局方式。
解決這個問題的方法就是重寫searchbar的intrinsicContentSize方法 ?給他指定寬高大小?
- (CGSize)intrinsicContentSize{
?returnCGSizeMake(ScreenWidth,31);
}
Intrinsic Contenet Size – Intrinsic Content Size:固有大小洁灵。顧名思義饱岸,在AutoLayout中,它作為UIView的屬性(不是語法上的屬性)徽千,意思就是說我知道自己的大小苫费,如果你沒有為我指定大小,我就按照這個大小來双抽。 比如:大家都知道在使用AutoLayout的時候百框,UILabel是不用指定尺寸大小的,只需指定位置即可牍汹,就是因?yàn)轭砦灰_定了文字內(nèi)容柬泽,字體等信息,它自己就能計(jì)算出大小來嫁蛇。? ?
ios 11的UISearchBar高度變了? 變成56了 以前是44
CGFloat height =44;
if(@available(iOS 11.0, *)) {
height =56;
}
CCSearchBar*mysearchBar = [[CCSearchBaralloc]initWithFrame:CGRectMake(0,0,ScreenWidth, height)];
2 .導(dǎo)航欄遇到的第二個問題:導(dǎo)航欄上的頭像 變形
原因是我用的
UIBarButtonItem*leftBarButtonItem = [[UIBarButtonItemalloc] initWithCustomView:personalButton];
這種方式 personalButton用的是frame布局 ? ?給他增加一個寬高的約束就可以了
NSLayoutConstraint*widthConstraint = [NSLayoutConstraintconstraintWithItem:personalButtonattribute:NSLayoutAttributeWidthrelatedBy:NSLayoutRelationEqualtoItem:nilattribute:NSLayoutAttributeNotAnAttributemultiplier:0.0constant:30];
[personalButtonaddConstraint:widthConstraint];
NSLayoutConstraint*heightConstraint = [NSLayoutConstraintconstraintWithItem:personalButtonattribute:NSLayoutAttributeHeightrelatedBy:NSLayoutRelationEqualtoItem:nilattribute:NSLayoutAttributeNotAnAttributemultiplier:0.0constant:30];
[personalButtonaddConstraint:heightConstraint];
3.SimplePing編譯不過的問題
由于iOS
framework 里面改了一下這句代碼的定義? 只需要把 check_compile_time 這個函數(shù)改成 __Check_Compile_Time 就行了 ?這兩個函數(shù)是一樣的 ?锨并。
check_compile_time(sizeof(IPHeader) ==20);
將所有的check_compile_time改為__Check_Compile_Time:
__Check_Compile_Time(sizeof(IPHeader) ==20);
3. Xcode9下相冊等訪問權(quán)限崩潰問題
查了資料說iOS11下,蘋果對相冊的權(quán)限key做了調(diào)整睬棚,原來的NSPhotoLibraryUsageDescription第煮,在iOS11之后,改成了NSPhotoLibraryAddUsageDescription抑党。
所以你可以在info.plist 把 key 改成NSPhotoLibraryAddUsageDescription, 很快解決問題了.