Skip to content

Label in Code Objective C 2

Azmal Tech edited this page Dec 27, 2016 · 1 revision
  1. UILabel *fromLabel = [[UILabel alloc]initWithFrame:CGRectMake(91, 15, labelSize.width, labelSize.height)];

  2. fromLabel.text = text;

  3. fromLabel.font = customFont;

  4. fromLabel.numberOfLines = 1;

  5. fromLabel.baselineAdjustment = UIBaselineAdjustmentAlignBaselines;

  6. // or UIBaselineAdjustmentAlignCenters, or UIBaselineAdjustmentNone

  7. fromLabel.adjustsFontSizeToFitWidth = YES;

  8. fromLabel.adjustsLetterSpacingToFitWidth = YES;

  9. fromLabel.minimumScaleFactor = 10.0f/12.0f;

  10. fromLabel.clipsToBounds = YES;

  11. fromLabel.backgroundColor = [UIColor clearColor];

  12. fromLabel.textColor = [UIColor blackColor];

  13. fromLabel.textAlignment = NSTextAlignmentLeft;

  14. [collapsedViewContainer addSubview:fromLabel];

Clone this wiki locally