0
假設我有一個CoreText NSMutableAttributedString
用這句話:「繼續閱讀」Coretext使一部分nsmutableattributtedstring聯
我要打的第一個字「繼續」點擊,這樣我可以點擊它,並顯示負載另一個UIView
。我已經找到了如何將它加下劃線並將顏色更改爲藍色,但我怎樣才能使它可以鏈接。任何示例?
這是我的代碼,它使下劃線和前景色爲藍色。
CFAttributedStringSetAttribute(string, CFRangeMake(0, 10),kCTForegroundColorAttributeName, [UIColor blueColor].CGColor);
SInt32 type = kCTUnderlineStyleSingle;
CFNumberRef underline = CFNumberCreate(NULL, kCFNumberSInt32Type, &type);
CFAttributedStringSetAttribute(string, CFRangeMake(0, text.length),kCTUnderlineStyleAttributeName, underline);
CFAttributedStringSetAttribute(string, CFRangeMake(0, text.length),kCTUnderlineColorAttributeName, [UIColor blueColor].CGColor);
感謝
CoreText純粹是一種渲染技術。它不處理交互。如果你需要可點擊的單詞,你需要自己實現。那裏可能有一個第三方庫,但它已經做到了。 –
嗨凱文,謝謝你的興趣...請任何例子。 – stefanosn
我相信你可以儘可能地使用Google。 –