1.导航栏下面的1px黑线bug
在base类中设置如下方法即可
-(void)hideNavigationBarBottomLine:(BOOL)hidden{
//iOS10及以上的隐藏方法
if ([UIDevice currentDevice].systemVersion.floatValue >= 10.0) {
if ([self.navigationController.navigationBar respondsToSelector:@selector(setBackgroundImage:forBarMetrics:)]) {
NSArray *list=self.navigationController.navigationBar.subviews;
for (id obj in list) {
//10.0的系统字段不一样
UIView *view = (UIView*)obj;
for (id obj2 in view.subviews) {
if ([obj2 isKindOfClass:[UIImageView class]]) {
UIImageView *image = (UIImageView*)obj2;
if (image.frame.size.height <= 1) {
image.hidden = hidden;
}
}
if ([obj2 isKindOfClass:[UIView class]]) {
UIView *view2 = (UIView *)obj2;
if (view2.frame.size.height <= 1) {
view2.hidden = hidden;
}
}
}
}
}
return;
}
//iOS10以下的隐藏方法
if ([self.navigationController.navigationBar respondsToSelector:@selector(setBackgroundImage:forBarMetrics:)]){
NSArray *list = self.navigationController.navigationBar.subviews;
for (id obj in list) {
if ([obj isKindOfClass:[UIImageView class]]) {
UIImageView *imageView = (UIImageView *)obj;
NSArray *list2 = imageView.subviews;
for (id obj2 in list2) {
if ([obj2 isKindOfClass:[UIImageView class]]) {
UIImageView *imageView2 = (UIImageView *)obj2;
if (imageView2.frame.size.height <= 1) {
imageView2.hidden = hidden;
}
}
if ([obj2 isKindOfClass:[UIView class]]) {
UIView *view2 = (UIView *)obj2;
if (view2.frame.size.height <= 1) {
view2.hidden = hidden;
}
}
}
}
}
}
}
2.iOS11以下tableview的header和footer重叠的bug
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
{
if ([UIDevice currentDevice].systemVersion.floatValue < 11.0) {
return 0.1f;
}else{
return 0;
}
}
网友评论