Swift todo List change labeltext - swift

I'm making a todolist app in swift 3. So far I have this result :
I can add a row, delete a row and when I click on a row it gives me this :
The details is displayed in a Label, I'd like to be able to edit it when cliked on the label, like in a note app. Keeping the whole existing text and enable the user to add or erase things in it. I red that it is not possible to edit a label so I was wondering how is it possible to do that ?

A UILabel is used for content that you don't want to be editable. Try using a UITextView here.

Related

How to create an expandable and collapsable menu WITHOUT a tableviewcontroller

I have a question. I am trying to create an expandable FAQ menu without using a tableviewcontroller. The reason I don't want to use a tableview is because I don't want expandable cells, rather, I want a buttonclick to reveal a label while also sliding down any other buttons on this page.
I'm using Swift in Xcode 7.3
If anyone has any suggestions/knows of a tutorial/a forum post, it would be greatly appreciated.
Thank You.
Sure,nyou could use buttons, and either change constraints on label heights or dynamically add labels. That's a lot of effort and code.
Or, you could use a table view and one of the myriad guides. Remember that table views don't have to be selectable on ever row, and they don't have to display row separator lines (UI).
Indeed you could disable selection on all rows and add buttons to some rows, though I'd personally say that's overkill and why require the user to be 100% accurate with the tap on a button which in your sample image doesn't even look like a button.

Should I make separate UIViewController just because a single row is different in layout

I am a very basic SWIFT Xcode programmer. I make small apps.
For last 2 days, I am stuck at a very simple thing and I am sure with your guidance I can quickly make a decision.
I have a UIViewController class as well as an xib
In the layout I have 4 textfields
Now based on a user setting (in another frame user make a choice), I will either have to show 4 textfields ** OR ** 3 textfields and a UISwitch.
Long story short, if user select one option he should see UISwitch and 3 textfields or else 4 textfield. The labels's text also change.
To my limited knowledge, I will make another UIViewController, another XIB file and if user selection allows I will segue to the new UIViewController.
But all this looks so redundant. How do you smart people do this thing?
(Edit)
I use size classes in my layout as well as constraints in the visual editor for positioning of elements on the layout. If I change things programmatically, which is one option, how will I manage the layout ?
Please advise.
Show me the right path please.
When user select first option based on action show or hide the text field or switches, like when user select first option only show three text field and one UIswitch hide fourth text field.
And programatically change text field hint value and also set NSString Tag="first" so that when you want that value at the time of submit button you can apply if condition to tag and on that basis you can get your desired output on each selection.

how to add custom label view to uitextview?

I am developing one message application in ios for iPhone .
i have one textview in which i have to write name of persons and on input space in uitextview i have to show the previously entered content in different text with different background .let me explain with image!
can anyone help me how can i achieve this kind of thing in my text view with CROSS MARK and on click of Cross Mark I want to delete that bubble?
so when user inputs the space after write some string in textview then it will convert with following view in green background with cross button..
You want to use some type of token field. Search github. Something like this.

UITableView - create single delete button for multi-row section

I am looking to recreate the multi-row delete functionality of the Contacts App on the iPhone.
How do you get the single delete button centered?
Thanks.
You would need to create a custom cell with a text box for each of the fields. This could actually be done in interface builder, which I think you be easier to align the text boxes appropriately.
Click on the link below, this tutorial shows how to create a custom cell with a text box. Just make the cell larger with more text boxes. Not so bad.
Good Luck.
http://nadacode.com/2010/07/25/creating-a-table-based-form-on-the-iphone/

Implementing a tableview with multiple labels inside a cell

The tableview I am implementing is a kind of phonebook, where I have an entry(name) and below that I am displaying his/her phone numbers. These data make my cell.
An entry(name) can have multiple phone numbers(each phone number displayed in different lines). Against each phone number(in the same line) I have an option to set some status message. How can I implement this.
The way I have gone forward is:
I have created a 2 labels inside a cell. One for displaying the name and the other for displaying the numbers. These numbers are displayed in a multiline way. The problem I am facing is, adding the status message against each phone number(in the same row of each number). For that I may have to add the status as text in between the phone numbers(displayed in a multiline way) in the same label or I have to add another label inside this label. I am a bit confused regarding, how to go about this. Need help.
For multiple UILable in a cell, you can use custom cell.
What you are trying to implement is something like this or this. check it out.
Personnaly, I would add the "To" view as a subview of your UILabel and then set the toView.frame.origin.y to index * label.font.lineHeight.