您好, 欢迎来到 !    登录 | 注册 | | 设为首页 | 收藏本站

UIAlertController内的多行可编辑文本UITextview?

UIAlertController内的多行可编辑文本UITextview?

这是很好的环境…

func popUpController()
{

    let alertController = UIAlertController(title: "\n\n\n\n\n\n", message: nil, preferredStyle: UIAlertController.Style.actionSheet)

    let margin:CGFloat = 8.0
    let rect = CGRect(x: margin, y: margin, width: alertController.view.bounds.size.width - margin * 4.0, height: 100.0)
    let customView = UITextView(frame: rect)

    customView.backgroundColor = UIColor.clear
    customView.font = UIFont(name: "Helvetica", size: 15)



    //  customView.backgroundColor = UIColor.greenColor()
    alertController.view.addSubview(customView)

    let somethingAction = UIAlertAction(title: "Something", style: UIAlertAction.Style.default, handler: {(alert: UIAlertAction!) in print("something")

        print(customView.text)

    })

    let cancelAction = UIAlertAction(title: "Cancel", style: UIAlertAction.Style.cancel, handler: {(alert: UIAlertAction!) in print("cancel")})

    alertController.addAction(somethingAction)
    alertController.addAction(cancelAction)

    self.present(alertController, animated: true, completion:{})


}
其他 2022/1/1 18:13:56 有580人围观

撰写回答


你尚未登录,登录后可以

和开发者交流问题的细节

关注并接收问题和回答的更新提醒

参与内容的编辑和改进,让解决方法与时俱进

请先登录

推荐问题


联系我
置顶