如何显示像“|”这样的特殊字符在UIlabel?

时间:2013-12-24 11:46:28

标签: ios iphone objective-c ipad uilabel

UIlabel我无法显示字符"|",我尝试过

[lLebel setText:[NSString stringWithFormat@"%s",[@"your_string" UTF8String]];

我在"|"的位置使用"your_string",但仍然没有显示。但是当我使用"%"时,它显示"%"(显示正确)。

我在我的标签上方重载了自定义GLTapLabel(https://github.com/laullon/GLTapLabelDemo/blob/master/GLTapLabelDemo)。这是不能表现出特殊性格的原因吗?

请指导我正确的方向......

2 个答案:

答案 0 :(得分:0)

myLabel.text = @"|"; 

工作得很好!

答案 1 :(得分:0)

使用它对我有用

UILabel *label=[[UILabel alloc]initWithFrame:CGRectMake(90, 7, 187, 30)];
    label.font=[UIFont systemFontOfSize:15.0];
    label.backgroundColor=[UIColor grayColor];

    label.userInteractionEnabled=NO;
    [label setText:
     @"|"];

    [self.view addSubview:label];