ios - drawRect on a UINavigationBar subclass makes the status bar go black -


i have same issue thread here. can manage make status bar visible making text white isn't goal. mean color on top of bar, navigation bars do. i've been able achieve adding shapes want views, under layoutsubviews, way can't interact or see uinavigationitem. code:

- (void)drawrect:(cgrect)rect { [super drawrect:rect]; cgcontextref context = uigraphicsgetcurrentcontext(); [[uicolor yellowcolor] setfill]; uirectfill(rect); 

this result:

enter image description here

this bast can achieved drawrect:

enter image description here

and happens if under layoutsubviews:

enter image description here

as can see, text, arrow, lost. i'm looking way make drawrect work! in advance help!

first, set navbar invisible with:

navcontroller.navigationbar.translucent = true navcontroller.navigationbar.setbackgroundimage(uiimage(), forbarmetrics: .default) navcontroller.navigationbar.shadowimage = uiimage() navcontroller.navigationbar.backgroundcolor = uicolor.clearcolor() 

create view in storyboard or xib , make property in vc, add with:

navcontroller.view.insertsubview(navbarview, belowsubview: (navigationcontroller?.navigationbar)!) 

after subview should appear behind bar buttons , can work custom navbarview, remember remove navbarview , return navbar default when view disappear:

navcontroller.navigationbar.translucent     = false navcontroller.navigationbar.shadowimage     = nil navcontroller.navigationbar.setbackgroundimage(nil, forbarmetrics: .default) navcontroller.navigationbar.backgroundcolor = uicolor.whitecolor() 

Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -