Justified Alignment in UITextView - iPhone

后端 未结 6 1495
名媛妹妹
名媛妹妹 2020-12-03 02:54

In my application, i have a UITextView with many lines, but I need the data with proper appearance.

Is it possible to have Justified Alignment in

6条回答
  •  天命终不由人
    2020-12-03 03:24

    There is solution:

    NSString *text1 = @"Sample text : A his is my weblog in English, German and Korean. If you want to know more about a pizza stone once it’s cooled down.";
    
    NSMutableParagraphStyle *style =  [[NSParagraphStyle defaultParagraphStyle] mutableCopy];
    [style setAlignment: kCTJustifiedTextAlignment];
    
    NSAttributedString * subText1 = [[NSAttributedString alloc] initWithString:text1 attributes:@{
                                                    NSParagraphStyleAttributeName : style
                                         }];
    
    _myUiTextView.attributedText = subText1;
    

提交回复
热议问题