Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/118.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 如何减少警报操作标题_Ios_Swift_Uialertcontroller - Fatal编程技术网

Ios 如何减少警报操作标题

Ios 如何减少警报操作标题,ios,swift,uialertcontroller,Ios,Swift,Uialertcontroller,我想从警报操作中删除标题部分。 将标题字符串设置为“”不会删除标题部分 @IBAction func addImage(sender: AnyObject!) { let alert:UIAlertController = UIAlertController(title: "" ,message: nil, preferredStyle: UIAlertControllerStyle.ActionSheet) let cameraAction = UIAlertAction(

我想从警报操作中删除标题部分。 将标题字符串设置为“”不会删除标题部分

@IBAction func addImage(sender: AnyObject!) {

    let alert:UIAlertController = UIAlertController(title: "" ,message: nil, preferredStyle: UIAlertControllerStyle.ActionSheet)

    let cameraAction = UIAlertAction(title: "Take Photo", style: UIAlertActionStyle.Default)
        {
            UIAlertAction in
            self.openCamera()
    }
    let gallaryAction = UIAlertAction(title: "Choose Photo", style: UIAlertActionStyle.Default)
        {
            UIAlertAction in
            self.openGallary()
    }
    let cancelAction = UIAlertAction(title: "Cancel", style: UIAlertActionStyle.Cancel)
        {
            UIAlertAction in

    }

    // Add the actions
    alert.addAction(cameraAction)
    alert.addAction(gallaryAction)
    alert.addAction(cancelAction)

    // Present the controller
    self.presentViewController(alert, animated: true, completion: nil)

}
这就是我得到的:

如何将标题部分一起删除?

“标题”是可选值,如果传递nil而不是空字符串,它将删除标题区域

让alert:UIAlertController=UIAlertController(title:nil,message:nil,preferredStyle:UIAlertControllerStyle.ActionSheet)

“title”是一个可选值,如果传递nil而不是空字符串,它将清除标题区域


let alert:UIAlertController=UIAlertController(标题:nil,消息:nil,首选样式:UIAlertControllerStyle.ActionSheet)

您是否尝试传递“nil”而不是空字符串?这是一个可选值啊..它起作用了。如果您想将其作为答案发布,我将接受。您是否尝试过传递“nil”而不是空字符串?这是一个可选值啊..它起作用了。如果你想把它作为一个答案贴出来,我会接受的妙招!:)