- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
我成功地添加了指向 UILabel
的链接通过OHAttributeLabel
和 -(void)addCustomLink:(NSURL*)linkUrl inRange:(NSRange)range;
换句话说,正确的范围带有下划线并且看起来像一个链接。
但是,我无法点击/触摸链接。 addCustomLink
还有什么必须做的吗?关于文本范围的方法? FWIW,即使 OHAttributedLabel
的大部分内容,我也没有使用 Interface Builder代码引用了 IBOutlet
.
最佳答案
在这种情况下所需的代码很简单:
[myLabel setDelegate:self];
对于那些感兴趣的人来说,上下文是:
descriptionLabel.attributedText = [NSMutableAttributedString attributedStringWithString:@"foo"];
[myLabel addCustomLink:[NSURL URLWithString:urlString] inRange:NSMakeRange(myLocation, myLength)];
[myLabel setDelegate:self];
非常感谢!
关于ios - 如何在 OHAttributedLabel 中使 CustomLink 可触摸,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10116820/
引用OHAttributedLabel numberOfLines问题。我创建了一个 OHAttributedLabel 并在设置 attributedText 时我的应用程序崩溃了。标签上显示的文本
我怎么换行OHAttributedLabel ?我的以下代码不起作用。 OHAttributedLabel *lbl = [[OHAttributedLabel alloc] init]; lbl.l
这是代码: NSString *labelString = @"Username: \n some text"; NSMutableAttributedString *labelAttributedS
我正在使用自定义 UILabel 类 OHAttributedLabel 将我的文本显示为 JUSTFIED 。在我的 OHAttributedLabel 之后,我想显示一个 UIButtton 。如
在属性列表中我有这样一个字符串: A |picture| is worth *1000\* words. 显然“图片”应该是斜体,“1000”应该是粗体。我正在尝试使用 OHAttributedLab
我使用一个名为 demoLbl 的 OHAttributedLabel 来显示带有格式化区域的文本。这个标签是用 Interface Builder 布置的,并连接到我的 ViewController
我在我的自定义 UITableViewCell 中使用 OHAttributedLabel,我尝试分析应用程序,因为应用程序似乎正在使用内存,就像理智一样。所以这是我发现的: 关于如何减少这种内存消耗
我使用 OHAttributedLabel 和 NSAttributedString+Attributes.h 来设置属性标签,我成功地实现了这一点。但是我注意到字体大小和外观不起作用。我也更改了字体
我正在使用 CocaPods 将 AFNetowrking 和 OHAttributedLabel 添加到我的项目中。我安装了这两个库。 AFNetworking 在我的项目中导入得很好。但是 OHA
我成功地添加了指向 UILabel 的链接通过OHAttributeLabel和 -(void)addCustomLink:(NSURL*)linkUrl inRange:(NSRange)range
我将 URL 添加到 OHAttributedLabel 中的属性字符串(“忘记密码”链接到 www.xxx.com“)。一切看起来都很完美,除了当我点击该字符串时,没有任何反应。 它应该在 safa
我试图在 TTTAtributedLabel、OHAttributedLabel 或 SETextView 上设置 NSBackgroundColorAttributeName 属性,但它不起作用.有
我是一名优秀的程序员,十分优秀!