0

I don't know about custom alertview. I want to create a custom alertview . In that custom alertview I just want to add textfields button, labesl & tableview. How can I create that custom alertview with storyboard. I just want custom alertview when user click a button like this:

table image

Caleb
  • 124,013
  • 19
  • 183
  • 272
  • 1
    Hi and welcome. Unfortunately your question is too broad. If you have don't so already I suggest you take the site [tour] and read the "how to ask" section of the site [help]. You can't add those controls to `UIAlertView`, you will need to write code... – Paulw11 Sep 11 '18 at 11:07
  • This is your solution: 1. https://stackoverflow.com/questions/27635814/how-to-add-uitableview-in-uialertcontroller-in-ios8 2. https://stackoverflow.com/questions/29896005/ios-8-and-later-uitableview-inside-an-uialertcontroller – Mukesh Sep 11 '18 at 12:32
  • @Mukesh tqs for ur reply But i want to use story board to design custom alertview. Just now I added image in my question. If u know something please help me – ananth reddy Sep 11 '18 at 12:41

1 Answers1

3

In that custom alertview I just want to add textfields button, labesl & tableview.

If you want that, then by definition you don't want to use an alert. Alerts are meant to display a short message to the user in an easily recognized style. Alerts are intentionally simple — Apple could easily have included API that would let you add an arbitrary view, but it didn't. That fact alone should tell you that you're swimming upstream.

Another reason that you don't want an actual UIAlertView is that that class has been deprecated since iOS 8. You might look at UIAlertController instead, but the intention for that class is also to keep it simple. The docs describe it like this: An object that displays an alert message to the user.

It sounds like what you're trying to do is to provide some sort of quick interaction where the user looks at or chooses from a list, possibly with controls for changing the list. A much better choice for that kind of thing is a modal view controller. A modal view controller is just a regular view controller presented modally, so that its content appears temporarily over the current screen. There are a number of different presentation styles available, including one where the underlying content is blurred before the modal content is displayed and one where the content is displayed in a popover window. This will give you a great deal more freedom than an alert will, while still providing that "this is a short interaction" sense that people associate with an alert.

How can I create that custom alertview with storyboard.

If you go with a modal view controller, then you can design it in your storyboard just like any other view controller, and you can add a segue to get to it from other view controllers.

Caleb
  • 124,013
  • 19
  • 183
  • 272