Multiple lines of text in UILabel

Set the line break mode to word-wrapping and the number of lines to 0: // Swift textLabel.lineBreakMode = .byWordWrapping textLabel.numberOfLines = 0 // Objective-C textLabel.lineBreakMode = NSLineBreakByWordWrapping; textLabel.numberOfLines = 0; // C# (Xamarin.iOS) textLabel.LineBreakMode = UILineBreakMode.WordWrap; textLabel.Lines = 0; Restored old answer (for reference and devs willing to support iOS below 6.0): textLabel.lineBreakMode = UILineBreakModeWordWrap; … Read more

C multi-line macro: do/while(0) vs scope block [duplicate]

Andrey Tarasevich provides the following explanation: On Google Groups On bytes.com [Minor changes to formatting made. Parenthetical annotations added in square brackets []]. The whole idea of using ‘do/while’ version is to make a macro which will expand into a regular statement, not into a compound statement. This is done in order to make the … Read more

Regular expression matching a multiline block of text

Try this: re.compile(r”^(.+)\n((?:\n.+)+)”, re.MULTILINE) I think your biggest problem is that you’re expecting the ^ and $ anchors to match linefeeds, but they don’t. In multiline mode, ^ matches the position immediately following a newline and $ matches the position immediately preceding a newline. Be aware, too, that a newline can consist of a linefeed … Read more