1. UIImageView*navBarHairlineImageView;
2. - (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;
}
3. -(void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
navBarHairlineImageView.hidden=YES;
}
-(void)viewWillDisappear:(BOOL)animated
{
navBarHairlineImageView.hidden=NO;
}
4- (void)viewDidLoad {
[super viewDidLoad];
navBarHairlineImageView= [self findHairlineImageViewUnder:self.navigationController.navigationBar];
</pre><pre name="code" class="objc">
</pre><pre name="code" class="objc">应该可以看得懂吧 写在不同的方法里面的。。不明白的可以来问我