_wifi_analyzer_label.numberOfLines = 0; _wifi_analyzer_label.lineBreakMode = NSLineBreakByWordWrapping; CGSize size = [_wifi_analyzer_label sizeThatFits:CGSizeMake(_wifi_analyzer_label.frame.size.height, MAXFLOAT)]; CGRect frame = _wifi_analyzer_label.frame; frame.size.height = size.height; [_wifi_analyzer_label setFrame:frame];
The above is the code implementation. If you don't use the code, you only need to compress the label height in the storyboard and it will automatically branch;