ios实用开发技巧

去掉导航栏上面的黑线和tableViewCell重复点击

2017-03-09  本文已影响99人  BigBossZhu

当导航栏多出了黑线是imageView导致的.通过下面的这两个方法可以去掉导航栏上面的细线.

//隐藏黑线
-(void)useMethodToFindBlackLineAndHind:(BOOL)isHidden
{
    UIImageView* blackLineImageView = [self findHairlineImageViewUnder:self.navigationController.navigationBar];
    //隐藏黑线(在viewWillAppear时隐藏,在viewWillDisappear时显示)
    blackLineImageView.hidden = isHidden;
}

- (UIImageView *)findHairlineImageViewUnder:(UIView *)view
{
    if ([view isKindOfClass:UIImageView.class] && view.bounds.size.height <= 1.0)
    {
        return (UIImageView *)view;
    }
    for (UIView *subview in view.subviews) {
        UIImageView *imageView = [self findHairlineImageViewUnder:subview];
        if (imageView) {
            return imageView;
        }
    }
    return nil;
}
上一篇下一篇

猜你喜欢

热点阅读