NSRangeException Out of Bounds error
NSRangeException Out of Bounds error
NSRangeException Out of Bounds error
Swift uses the same cocoa-touch API. You can call all the same methods, but they will use Swift’s syntax. In this example you can do something like this: self.simpleLabel.text = “message” Note the setText method isn’t available. Setting the label’s text with = will automatically call the setter in swift.
You need to use NSLineBreakByWordWrapping in iOS 6 For your code try this: NSString *string = @”bla”; CGSize s = [string sizeWithFont:[UIFont systemFontOfSize:20] constrainedToSize:CGSizeMake(self.view.bounds.size.width – 40, CGFLOAT_MAX) // – 40 For cell padding lineBreakMode:NSLineBreakByWordWrapping]; an example on a label would be: [label setLineBreakMode:NSLineBreakByWordWrapping]; Instead of label.lineBreakMode = UILineBreakModeWordWrap;