Splitting text in different TextViews SWIFT - ios

I have a big paragraph i want to add to a view. But the problem i am having is the first textview is small and then under it i have a map view. After the map view i want the text to continue from where it stopped in the first textview. I put an example below to show exactly what i mean.
#IBOutlet var firstSection: UITextView!
#IBOutlet var articleMapView: MKMapView!
#IBOutlet var secondSection: UITextView!
I want have a text above to map and and below it.

Related

Disable interaction on subview of UITableViewCell

I have a custom table cell with two subView in it. One of them should allow user interaction, and one of the views should not allow interaction.
I have already tried userInteraction enable and disable on UIView but didn't get any result.
#IBOutlet weak var headerView: UIView!
#IBOutlet weak var detailView: UIView!
The orange selected color is my detailView and i want to prevent user interaction on this view.

Is it possible to set inputView/ inputAccessoryView for textfields in storyboard?

I have picker and toolbar for textfields.
#IBOutlet var picker: UIDatePicker!
#IBOutlet var toolbar: UIToolbar!
#IBOutlet weak var toTF: UITextField!
#IBOutlet weak var fromTF: UITextField!
and then in viewDidLoad
fromTF.inputView = picker
toTF.inputView = picker
fromTF.inputAccessoryView = toolbar
toTF.inputAccessoryView = toolbar
Is it possible to avoid this code and set them in storyboard? (Like you do that for delegates, etc.) I can't find any possibilities.
As far as I can tell, this isn't possible. You can set the views up in your Storyboard/Xib as yo have done, but it looks like the actual connection logic needs to take place in code.

UILabel height depending on text

I am getting data from JSON and it changes for each view so I need the labels to change their height depending on their content and also the rest of labels and buttons should move down. I am using sizeToFit but anything else moves and when I scroll it loses its height and goes to 1 line again.
My labels have 0 lines in storyboard.
#IBOutlet weak var titulares: UILabel!
#IBOutlet weak var scroller: UIScrollView!
#IBOutlet weak var imagen: UIImageView!
#IBOutlet weak var estilo: UILabel!
#IBOutlet weak var historia: UILabel!
override func viewDidLoad() {
super.viewDidLoad()
// I get JSON Data
self.historia.sizeToFit()
self.titulares.sizeToFit()
self.estilo.sizeToFit()
Use autolayout
from the storyboard, press on a label and then in the right bottom side of the screen, you have the "Add new constrains" button.
Use it to set a spacing from a view to it's neighbors
https://developer.apple.com/library/tvos/documentation/UserExperience/Conceptual/AutolayoutPG/index.html

Make a button display an text input

So I am new on app development. I am currently using swift on Xcode 6.1 and I want to make a button to create a Table View Cell. So I need to do when the button is clicked prompt a text input with a name for you Cell, and after this name is typed create the cell.
My button and table view are:
#IBOutlet weak var charListIPhone: UITableView!
#IBOutlet weak var addCharIPhone: UIButton!

How to align content inside UITableViewCell for different screen sizes?

I have build a custom table cell:
class CustomTableViewCell: UITableViewCell {
#IBOutlet weak var streetLabel: UILabel!
#IBOutlet weak var cityLabel: UILabel!
#IBOutlet weak var priceLabel: UILabel!
func loadItem(#street: String, city: String, price: String){
self.streetLabel.text = street
self.cityLabel.text = city
self.priceLabel.text = price
}
}
Result on iPhone 5:
Result on iPhone 6+
As you can see the left side of the cell is displayed correctly, it sticks to the left. However the right side should stick to right but it does not. So here is my question:
How can the width of the cell be set to the width of the tableView so that the cell has the same width as the screen?
How can I make the right side actually stick to the right of the table cell?
UITableViewCells are always the with of the UITableView they are in so there is noting that you need to do.
Based on the screenshot you posted, it doesn't look like you are currently using autolayout to position your labels. What you'll need to do is just add a constraint from the right of your price label to the right of the cell. Then when the cell grows, your label will keep the same distance from the right edge of the cell.
Your constraints for the top labels should then look like this.

Resources