I want to create label in iOS, can anyone help me to make the first word of the label's text bold and clickable. The label displays username and its comment and the first word is always the username. Thanks in advance!
相关问题
- CALayer - backgroundColor flipped?
- Core Data lightweight migration crashes after App
- Core Data lightweight migration crashes after App
- How can I implement password recovery in an iPhone
- State preservation and restoration strategies with
相关文章
- 现在使用swift开发ios应用好还是swift?
- UITableView dragging distance with UIRefreshContro
- Could I create “Call” button in HTML 5 IPhone appl
- TCC __TCCAccessRequest_block_invoke
- Where does a host app handle NSExtensionContext#co
- xcode 4 garbage collection removed?
- Xcode: Is there a way to change line spacing (UI L
- Unable to process app at this time due to a genera
I suppose more elegant solution will be using TTTAttributedString or similar.
Example:
Output:
Key point:
Complete source code
Note that you should open
xcworkspace
in Xcode/AppCode because I'm using CocoaPods here.Hope it helps.
BR.
Eugene
labels seems to be difficult. Ypu can use a view. add a button and lable on that side by side and add 1st character to button and others to label.
Hope this will be clear to you.
Enjoy Programming!
You need to use
UITapGestureRecognizer
for makingUILabel
clickable. UseUIView
and addUILabel
as subviews to thatOne way of making first word
clickable
is to take out the first word from the label using the string method and store it in another label and use the above code to make it clickable