1

세로 구분선이있는 탭 막대의 배경 이미지를 표시하고 싶습니다.탭 막대 배경 이미지에 문제가 있습니다

like the one mentioned below

나는 다음과 같은 해상도에서이 이미지를 가지고있다 -

1 배 - 320 X 49

배 - 640 × 98

배 - 960 X 147

이미지는 아이폰 5에 맞게 구분선이 적절한 위치에 설정되지만 iPhone 6/7 및 iPhon에서는 제대로 렌더링되지 않습니다. e 6 +/7 +.

구분선이 적절한 위치에 있지 않고 일부 탭 모음 항목이 겹쳐져 있습니다.

enter image description here 참고 : Xcode 8.2를 사용하고 있습니다.

답변

0

UIView 만들기 이렇게하면 가운데 항목의 높이를 원하는대로 설정할 수 있습니다.

enter image description here

그리고 TabbarView 컨트롤러에서

. 이보기를 탭바보기에 추가보기 이렇게.

UITabBar.appearance().shadowImage = UIImage() 

     customNavBar = NSBundle.mainBundle().loadNibNamed("CustomTabBarView", owner: self, options: nil)[0] as! UIView 

     bdNavBar.translatesAutoresizingMaskIntoConstraints = false 

     self.tabBar.addSubview(customNavBar) 

그런 다음 사용자 정의 탭바에 제약 조건을 추가하십시오.

self.view.addConstraint(NSLayoutConstraint(item: customNavBar, attribute: .Left, relatedBy: .Equal, toItem: self.view, attribute: .Left, multiplier: 1.0, constant: 0)) 
self.view.addConstraint(NSLayoutConstraint(item: customNavBar, attribute: .Right, relatedBy: .Equal, toItem: self.view, attribute: .Right, multiplier: 1.0, constant: 0)) 
self.view.addConstraint(NSLayoutConstraint(item: customNavBar, attribute: .Bottom, relatedBy: .Equal, toItem: self.view, attribute: .Bottom, multiplier: 1.0, constant: 0)) 
bdNavBar.addConstraint(NSLayoutConstraint(item: customNavBar, attribute: NSLayoutAttribute.Height, relatedBy: .Equal, toItem: nil, attribute: NSLayoutAttribute.NotAnAttribute, multiplier: 1.0, constant: 50))   
self.tabBar.bringSubviewToFront(customNavBar)