7

I am getting a warning of deprecated in ios6 when using

 label.lineBreakMode=UILineBreakModeCharacterWrap;

Is there any other method for this?

BenMorel
  • 34,448
  • 50
  • 182
  • 322
Bond
  • 328
  • 4
  • 16

3 Answers3

11

from the documentation, use NSLineBreakByCharWrapping to eliminate the warning.

Singh
  • 2,151
  • 3
  • 15
  • 30
7

Use NSLineBreakByCharWrapping instead. The documentation for UILineBreakModeCharacterWrap points this out.

Mark Granoff
  • 16,878
  • 2
  • 59
  • 61
  • 1
    It would be helpful if you included a link to the documentation. –  Oct 25 '12 at 15:19
  • The documentation literally says "This is deprecated. Use this other thing instead." Which is what I put in my answer. My reference to the documentation was to suggest subtly to the original poster that maybe they should use it first, in the future. But yea... your point is valid. – Mark Granoff Oct 25 '12 at 15:26
  • is NSLineBreakByCharWrapping safe to use in iOS5? – Ben Clayton Oct 25 '12 at 16:09
  • @BenClayton: Actually, no. While `UILineBreakModeCharacterWrap` is deprecated, you can still use it, especially if you still need to support iOS versions earlier than iOS6. But moving forward, as developers begin dropping support for versions prior to iOS6, use of deprecated methods and such should be avoided. – Mark Granoff Oct 25 '12 at 16:36
2

As per the documentation

http://developer.apple.com/library/ios/#documentation/uikit/reference/UILabel_Class/Reference/UILabel.html

use NSLineBreakByCharWrapping to eliminate the warning.

label.lineBreakMode = NSLineBreakByCharWrapping;

and for the test alignment use..

label.textAlignment = NSTextAlignmentLeft;

Happy Coding!!!

kagmanoj
  • 5,038
  • 5
  • 19
  • 21