LoginSignup
6
6

More than 5 years have passed since last update.

UILabelで改行された文字列を上手いこと表示する方法

Last updated at Posted at 2012-07-31
UILabelSample

@implementation UILabelSample

- (void)initializeUILabel {
    // 幅と場所だけ決めておく
    UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 200, 0)];
    label.numberOfLines = 0;
    label.text = @"happy_ryo\nhappy_ryo\nhappy_ryo";
    // 高さを合わせる
    [label sizeToFit];
    [self.view addSubview:label];
}

@end


6
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
6