2016-06-22 11 views
0

私は1つの問題を抱えています.iOSでhtmlテキストを表示したいのですが、1つのラベルに値を表示しています。どのようにhtmlテキストで表示しましたか?ここに私が何をしたのですかiOSのHTML文字列にUILable値/テキスト値を表示するにはどうすればよいですか?

_name.text = tutorial.title;

_name.text私はhtml解析から価値を得ています。

これを使用して、私はhtmlテキストを表示していますが、どのようにこれに_name.text値を渡しますか?

これを使用すると、hiiや任意のメッセージをhtmlで表示することができますが、これでどのように解析値を追加できますか?

+0

あなたはさらにそれを説明することができますか?あなたはUILabelにhtmlテキストを表示したいですか? – Joshua

+0

nop htmlタグを使って_name.textのラベル値を表示したい@Joshua – Asmita

+0

これは同じことですか? http://stackoverflow.com/questions/15872257/display-html-text-in-uilabel-iphone – Joshua

答えて

1
//setting text on label 
[self.lblStatus setText:@"This is test data"]; 

//creating string with html format and adding label value in it 
NSString *my=[NSString stringWithFormat:@"<html> <body> <p align='center'> <font color='red' size='3'> <strong> <u> %@ </p> </u> </srong> </font> </body> </html>",self.lblStatus.text]; 

//here i'm printing string, you can load it in webview 
NSLog(@"My HTml String : %@",my); 
1

これはあなたが期待していたと仮定していますか?

NSString *my=[NSString stringWithFormat:@"<html> <body> <p align='center'> <font color='red' size='3'> <strong> <u> {textToReplace} </p> </u> </srong> </font> </body> </html>"]; 

my = [my stringByReplacingOccurrencesOfString:@"{textToReplace}" withString:_name.text]; 


i.e. 
input.text = @"this is a test"; 

// perform the stringReplacement 
    <html> <body> <p align='center'> <font color='red' size='3'> <strong> <u> this is a test </p> </u> </srong> </font> </body> </html> 
関連する問題