Size class specifically for portrait 3.5 inch (iPhone 4S) Xcode 6?

前端 未结 5 2150
遇见更好的自我
遇见更好的自我 2020-12-18 18:52

I\'m tuning my UI App, but I got an issue that I can\'t solve.

As I can see Compact height affects all iPhones under 4.7 inches, but my UI is fine except for the iPh

5条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-18 19:23

    @all I can't make things smaller, because I'm dealing with pickerviews which happen to have only three valid heights for UIPickerView (162.0, 180.0 and 216.0). Sizes and constraints apart.

    iPhone Sizes: http://www.idev101.com/code/User_Interface/sizes.html , 4S is unique.

    So although my approach it's a little bit ugly get the things done, nearly on my point.

    So I know it's far from Goodville, don't hit me down, just for sharing:

    func checkForiPhone4S()
    {
        if (UIScreen.mainScreen().bounds.size.height == 480) {
            println("It is an iPhone 4S - Set constraints")
    
            listPickerView.transform = CGAffineTransformMakeScale(1, 0.8);
    
            var constraintHeight = NSLayoutConstraint(item: listPickerView, attribute: NSLayoutAttribute.Height, relatedBy: NSLayoutRelation.Equal, toItem: nil, attribute: NSLayoutAttribute.NotAnAttribute, multiplier: 1, constant: 100)
    
            self.view.addConstraint(constraintHeight)
    
            datePickerView.transform = CGAffineTransformMakeScale(1, 0.8);
    
            var constraintHeightDate = NSLayoutConstraint(item: datePickerView, attribute: NSLayoutAttribute.Height, relatedBy: NSLayoutRelation.Equal, toItem: nil, attribute: NSLayoutAttribute.NotAnAttribute, multiplier: 1, constant: 100)
    
            self.view.addConstraint(constraintHeightDate)
    
        }
    }
    

提交回复
热议问题