Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create selecting option UITableView similar in iOS Settings in Swift?

I'm developing an app that requires users to select one option from the list of the table view. It's kind of similar to ringtone option in settings of the iPhone. I have attached a screen illustration of what exactly I'm trying to accomplish.

Now I want that option that is selected to be able to send as a value to my PHP Script with HTTPMethod. This is the type of request I use, I guess, is just in matter of storing the data in variable.

HTTP Request Demo

   let requestURL = NSURL(string: "http://example.com/script.php")
   let request = NSMutableURLRequest(URL: requestURL!)
   request.HTTPMethod = "POST"

Illustration: enter image description here

I understand this is a beginner, but I haven't found any tutorial that does this in swift.

like image 331
Brian Nezhad Avatar asked Nov 01 '22 03:11

Brian Nezhad


1 Answers

All this can be done using segue

  1. You just need to click a button or a cell in tableview to go to next viewController.You can use show segue
  2. When use select the cell,fire an unwind segue to go back. And use the unwind segue to pass data back.
  3. Update model and UI with the data passed back.
like image 60
Leo Avatar answered Nov 02 '22 22:11

Leo