How to Insert the Uitextview into Uialertview in iOS

How to Insert the UITextView into UIAlertview in iOS

the following link has resolved my problem, the link is https://github.com/wimagguc/ios-custom-alertview

the following content has resolved

  1. textview
  2. tableview
  3. ImageView
  4. UIWebView

both functionalities are worked as fine for me

UIAlertView + UITextView

I need to know how to achieve multiline text input on a UIAlertView

You don't. If you need more than what a built-in UIAlertView gives you, make your own presented view controller that looks and acts like a UIAlertView, except that the view is your view and you can customize it however you like.

Multiline editable text UITextview inside UIAlertController?

This is good appraoch ...

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:{})


}


Related Topics



Leave a reply



Submit