I want to give a tap action on part on a UILabel. For ex: If we have string like "My name is XYZ", in this case I want to add tap action for "XYZ" only.
How to do that in iOS (swift)
I want to give a tap action on part on a UILabel. For ex: If we have string like "My name is XYZ", in this case I want to add tap action for "XYZ" only.
How to do that in iOS (swift)
What about setting your label in a UIView next to a UIButton ?
UIView *view = [UIView new];
UILabel *label = [UILabel new];
UIButton *button = [UIButton new];
Add these constraints to view :
|[label][button]|
label.text = @"My name is"
[button setTitle:yourName forState:UIControlStateNormal];
By setting your label and your button's background colors to clearColor and your view's background ground to whiteColor ( for instance ) your shouldn't see that much difference.
There is control call TTTAttributedLabel which can handle the same in Objective-C So you can use that,
Then, in your TTTAttributedLabelDelegate:
For Swift you can do some thing like,