Ios UIAlertController文本字段中不需要的顶部空间

Ios UIAlertController文本字段中不需要的顶部空间,ios,objective-c,swift,xcode6,uialertcontroller,Ios,Objective C,Swift,Xcode6,Uialertcontroller,我试图创建一个对话框,要求保存文件名 不知何故,显示的文本字段上面有一个额外的空间,我无法删除它。空间不可用(它不是一条线,只是一个上边距) 即使尝试更改textfield的.frame.height属性,我也无法摆脱它 请帮忙!我不明白为什么会这样 截图: 代码是: var fieldSetListName: UITextField! func askForSetListName() { //Create the AlertController let al

我试图创建一个对话框,要求保存文件名

不知何故,显示的文本字段上面有一个额外的空间,我无法删除它。空间不可用(它不是一条线,只是一个上边距)

即使尝试更改textfield的.frame.height属性,我也无法摆脱它

请帮忙!我不明白为什么会这样

截图:

代码是:

    var fieldSetListName: UITextField!

    func askForSetListName() {

    //Create the AlertController
    let alertController: UIAlertController = UIAlertController(title: "Name", message: "Enter a name for Setlist", preferredStyle: .Alert)

    //Create and add the Cancel action
    let cancelAction: UIAlertAction = UIAlertAction(title: "Cancel", style: .Cancel) { action -> Void in
        //Do some stuff
    }
    alertController.addAction(cancelAction)

    //Create and an option action
    let okAction: UIAlertAction = UIAlertAction(title: "OK", style: .Default) { action -> Void in
    //Do some other stuff
    self.saveSetListAndDismiss(self.fieldSetListName.text)
    }

    alertController.addAction(okAction)
    //Add a text field
    alertController.addTextFieldWithConfigurationHandler { textField -> Void in
    textField.textColor = UIPalette.DarkText
    textField.placeholder = "(venue, festival, date etc.)"
    self.fieldSetListName = textField
    }

    //Present the AlertController
    self.presentViewController(alertController, animated: true, completion: nil)
    }

添加如下文本字段:

 var example :UITextField
 var inputText : String
 let exampletextField = actionSheetController.textFields![0] as UITextField
 exampletextField.textColor = UIPalette.DarkText
 exampletextField.placeholder = "(venue, festival, date etc.)"
 inputText = exampletextField.text
找到了解决办法

对于遇到此类问题的任何人,使用UIAppearance全局设置UITableView的rowHeight属性会影响alertview中的文本字段高度:

我删除了以下行:UITableView.appearance().rowHeight=50