2017-01-16 6 views
0

navigationBar의 titleview에 문제가 있습니다. 문제는 titleView에 뷰를 할당 할 때 표시되지 않는다는 것입니다. navigationItem.title = @"eqweqweq";을 사용하려고했지만 아무 일도 일어나지 않습니다.navigationItem.TitleView가 iOS 10에서 작동하지 않습니다.

이 뷰는 코드에 의해 생성됩니다. 문제가있는 경우 다른 뷰 컨트롤러를 사용했기 때문에 완벽하게 작동했기 때문에이 코드를 작성해야합니다.

iOS 10에는 titleView를 사용할 수없는 버그가 있습니까? 때로는 때때로 작동하지 않는 경우도 있습니다.

Google에서 검색했지만 나에게 도움이되지 않았습니다. 누군가가 나를 도와 줄 수 있기를 바랍니다.

감사합니다.

+1

titleView를 설정하면 제목이 사용되지 않습니다. 당신이하는 일에 대한 몇 가지 코드를 보여 주시겠습니까? –

답변

0

이 시도하십시오

UILabel *lblTitle = [[UILabel alloc] init]; 
lblTitle.text = @"eqweqweq"; 
lblTitle.backgroundColor = [UIColor clearColor]; 

[lblTitle sizeToFit]; 

self.navigationItem.titleView = lblTitle; 

또는가 직접 아래와 같이 navigationItemtitle을 설정

중 하나는 다음과 같은 navigationItemtitleView을 설정합니다. 그것은 나를 위해 작동합니다.

self.title = "eqweqweq" 

는 것 마지막으로 내가 문제가 해결했습니다 고마워

0

을 도움이되기를 바랍니다!

문제는이 기능을이었다

extension UINavigationController{ 
func applyWhiteEffect(){ 
     var bounds = self.navigationBar.bounds 
     let whiteView = UIView() 
     bounds.origin.y = -20 
     bounds.size.height = bounds.size.height + 20 
     whiteView.frame = bounds 
     whiteView.autoresizingMask = [.FlexibleWidth, .FlexibleHeight] 
     whiteView.userInteractionEnabled = false 
     whiteView.backgroundColor = UIColor.whiteColor() 
     whiteView.tag = 1000 
     self.navigationBar.addSubview(whiteView) 
     self.navigationBar.backgroundColor = UIColor.clearColor() 
     self.navigationBar.sendSubviewToBack(whiteView) 
    } 
} 

이 기능은 흰색 뷰를 적용하고 그와 아이폰 OS (10)에 문제가 있었다, 그래서 나는이 변경했습니다

func applyWhiteEffect(){ 
     var bounds = self.navigationBar.bounds 
     let whiteView = UIView() 
     bounds.origin.y = -20 
     bounds.size.height = 20 
     whiteView.frame = bounds 
     whiteView.autoresizingMask = [.FlexibleWidth, .FlexibleHeight] 
     whiteView.userInteractionEnabled = false 
     whiteView.backgroundColor = UIColor.whiteColor() 
     whiteView.tag = 1000 
     self.navigationBar.addSubview(whiteView) 
     self.navigationBar.backgroundColor = UIColor.whiteColor() 
     self.navigationBar.sendSubviewToBack(whiteView) 
    } 

변경 상태 표시 줄 만 볼 수있는보기 및 self.navigationBar.backgroundColor = UIColor.whiteColor()

어쨌든 도와 주셔서 감사합니다. D