您的位置:首页 > 产品设计 > UI/UE

去掉UINavigationBar下面黑线方法

2014-12-25 11:23 281 查看
方法1:修改阴影

[[UINavigationBar appearance] setShadowImage:[[UIImage alloc] init]];


方法2:在某一个查找到视图隐藏
NSArray *list=self.navigationController.navigationBar.subviews;

for (id obj in list) {

if ([obj isKindOfClass:[UIImageView class]]) {

UIImageView *imageView=(UIImageView *)obj;

imageView.hidden=YES;

}

}


方法3:
+ (UIImage *)imageWithColor:(UIColor *)color size:(CGSize)size

{
CGRect rect = CGRectMake(0, 0, size.width, size.height);

UIGraphicsBeginImageContext(rect.size);

CGContextRef context = UIGraphicsGetCurrentContext();

CGContextSetFillColorWithColor(context,

color.CGColor);

CGContextFillRect(context, rect);

UIImage *img = UIGraphicsGetImageFromCurrentImageContext();

UIGraphicsEndImageContext();

return img;
}
if ([UINavigationBar instancesRespondToSelector:@selector(setShadowImage:)])

{

[[UINavigationBar appearance] setShadowImage:[UIImage imageWithColor:[UIColor clearColor] size:CGSizeMake(320, 3)]];

}


最简单的是方法1
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: