Remove that 1px line from UINagivationBar in iOS7.
There must be a way to remove it in the future but for now here is how.
[self.navigationController.navigationBar.subviews enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL stop) {
if ([obj isKindOfClass:NSClassFromString(@"_UINavigationBarBackground")]){
UIView v = obj;
[[v.subviews objectAtIndex:1] removeFromSuperview];
*stop=YES;
}
}];
Written by Apisit Toompakdee
Related protips
3 Responses

Thanks, I looked for that code, but one thing: I would add that line to prevent an exception:
[self.navigationController.navigationBar.subviews enumerateObjectsUsingBlock:
^(id obj, NSUInteger idx, BOOL *stop) {
if ([obj isKindOfClass:NSClassFromString(@"_UINavigationBarBackground")]){
UIView* v = obj;
if ([v.subviews count] > 0) {
[[v.subviews objectAtIndex:0] removeFromSuperview];
*stop=YES;
}
}
}];
over 1 year ago
·
Thanks :)
over 1 year ago
·

But it change color of navigation bar lightly
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Objective-c
Authors
Related Tags
#objective-c
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#