-1

UILabel cannot show its all letters. My app is like now my app

PhotoController (it is for this page)is

import Foundation
import MobileCoreServices
import UIKit
class PhotoController:UIViewController,UINavigationControllerDelegate,UIImagePickerControllerDelegate{

    @IBOutlet weak var label: UILabel!
    @IBOutlet weak var myImageView: UIImageView!
    private var imagePicker:UIImagePickerController!

    override func viewDidLoad() {
        super.viewDidLoad()

        label.text = "Tap the PhotoSelect or Camera to upload a picture"
        //myImageUploadRequest()


    }

So,all letter of

label.text = "Tap the PhotoSelect or Camera to upload a picture"

is not shown in my app.

What should I do to fix this?

user8080149
  • 59
  • 1
  • 7

3 Answers3

1
label.numberOfLines = 0

Thats all you need :)

EDIT:

Setting line break modes to the label will help you get further improved O/P

label.lineBreakMode = .byWordWrapping //choose whichever matches ur requirement
Sandeep Bhandari
  • 19,999
  • 5
  • 45
  • 78
  • @anbu-karthik : UILabels have intrinsic size. So unless he has applied height constraint to UILabel (I hope he has not) setting lineNumber to 0 will make the text grow more than one line and because of intrinsic size label will grow as well :) – Sandeep Bhandari Jun 13 '17 at 11:30
0
label.numberOfLines = 0

Either make your label multi line or

   label.adjustsFontSizeToFitWidth = true

label.minimumScaleFactor = 0.5
Developer
  • 822
  • 9
  • 23
0

from storyboard

  1. Constraints :

Give constant label height with relationship >=

  1. Property

set number of lines = 0

dahiya_boy
  • 9,298
  • 1
  • 30
  • 51