2017-10-04 4 views
0

로 지정 UINavigationBar 아이폰 OS : 당신은 안드로이드에 동일하게 볼 수있는 두 UITextView나는 iOS에서 다음 달성하기 위해 노력하고 UITextView

우는 소리와 사용자 지정 UINavigationBar 아이폰 OS를.

UINavigationBar에서 가능합니까? 어떻게해야합니까?

사용자 지정 UIView를 사용하여 UIBarButtonItem을 사용했지만 크기가 제한되어 있으므로 원하는 것을 성취 할 수 없었습니다.

Android Example

+0

지금까지 해보신 것은 무엇입니까? – picciano

답변

0

이런 식으로 뭔가. 스토리 보드에서는 불가능하며 시도하지도 않습니다.

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { 

    window = UIWindow(frame: UIScreen.main.bounds) 
    window?.makeKeyAndVisible() 

    let layout = UICollectionViewFlowLayout() 


    UINavigationBar.appearance().barTintColor = UIColor.yellow 


    UINavigationBar.appearance().shadowImage = UIImage() 
    UINavigationBar.appearance().setBackgroundImage(UIImage(), for: .default) 

    application.statusBarStyle = .lightContent 

    let textViewOne = UITextView() 
    textViewOne.text = "1000" 


    window?.addSubview(textViewOne) 
    //top constraint 

    window?.addConstraintsWithFormat("H:[v0(100)]-16-|", views: textViewOne) 

    window?.addConstraintsWithFormat("V:|-16-[v0(24)]", views: textViewOne) 
    return true 
} 



extension UIView { 
    func addConstraintsWithFormat(_ format: String, views: UIView...) { 
     var viewsDictionary = [String: UIView]() 
     for (index, view) in views.enumerated() { 
      let key = "v\(index)" 
      view.translatesAutoresizingMaskIntoConstraints = false 
      viewsDictionary[key] = view 
     } 

     addConstraints(NSLayoutConstraint.constraints(withVisualFormat: format, options: NSLayoutFormatOptions(), metrics: nil, views: viewsDictionary)) 
    } 
} 
+0

나머지 개체를 추가하기 만하면됩니다. –

관련 문제