亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

ios - UITextView 顯示特殊字符會導致錯誤的行高和字號
PHPz
PHPz 2017-04-17 17:27:25
0
0
440

用相同的代碼顯示不同的字符順序的NSMutableAttributedString,會導致行高和字號的BUG。

▲●■▲●■▲●■*asdf
●▲■▲●■▲●■*asdf
■●■▲●■▲●■*asdf

最后兩行是僅第一個字符和僅○設置Attributes,可以看出會影響后面沒有設置的字符

code

    NSMutableAttributedString *symbol = [[NSMutableAttributedString alloc] initWithString:@"●▲■▲●■▲●■*asdf"];
    UIFont *symbolFont = [UIFont systemFontOfSize:24.0];
    UIColor *stripesPurple = [UIColor colorWithRed:0.83 green:0.64 blue:0.83 alpha:1];
    
    
    [symbol addAttributes:@{NSForegroundColorAttributeName:[UIColor purpleColor],
                            NSFontAttributeName:symbolFont,
                            NSStrokeWidthAttributeName:@-4,
                            NSStrokeColorAttributeName:[UIColor purpleColor]}
                    range:NSMakeRange(0, 3)];
    [symbol addAttributes:@{NSForegroundColorAttributeName:stripesPurple,
                            NSFontAttributeName:symbolFont,
                            NSStrokeWidthAttributeName:@-4,
                            NSStrokeColorAttributeName:[UIColor purpleColor]}
                    range:NSMakeRange(3, 3)];
    [symbol addAttributes:@{NSForegroundColorAttributeName:[UIColor whiteColor],
                            NSFontAttributeName:symbolFont,
                            NSStrokeWidthAttributeName:@-4,
                            NSStrokeColorAttributeName:[UIColor purpleColor]}
                    range:NSMakeRange(6, 3)];
    //[self.myTextView setAttributedText:symbol];
    [self.attrLabel setAttributedText:symbol];
PHPz
PHPz

學習是最好的投資!

reply all(0)
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template