- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我正在尝试在自定义 UIButton 上为我的标题添加下划线,但是按照找到的示例 here ,我无法让它显示在屏幕上。
这是我尝试使用的代码:
NSMutableAttributedString *commentString = [[NSMutableAttributedString alloc] initWithString:@"The Quick Brown Fox"];
[commentString addAttribute:NSUnderlineStyleAttributeName value:[NSNumber numberWithInteger:NSUnderlineStyleSingle] range:NSMakeRange(0, [commentString length])];
[button setAttributedTitle:commentString forState:UIControlStateNormal];
这不会出现。但如果我只是做一个普通的,像这样:
[button setTitle:@"The Quick Brown Fox" forState:UIControlStateNormal];
这显示很好。有人可以告诉我我缺少什么吗?
最佳答案
我意识到这里的问题。我以为它没有出现,因为我看不到它。但是,它正在显示,它只是与背景颜色相同。
我错误地认为 [button setTitleColor:myColor forState:UIControlStateNormal];
也是 attributedTitle 将使用的颜色。但是,我的背景是黑色的,NSMutableAttributedString 必须默认为黑色。
[commentString addAttribute:NSForegroundColorAttributeName value:myColor range:NSMakeRange(0, [commentString length])];
使其正确显示。
关于objective-c - UIButton setAttributedTitle : forState: Not Showing Up,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18234797/
我有一个扩展程序,我已经拆掉了裸机,它使自己处于不正确的状态,当它折叠时它会说“显示更少”。 这有两种情况 我使用“显示更多”展开扩展,然后离开屏幕。我打开另一个应用程序,然后返回到扩展程序。扩展的扩
为什么这些不相等? show $ if someCondition then someInt else some double 和 if someCondition then show someInt
下面给出的代码可以编译,ok。 data Car p q r = Car {company :: p , model :: q
是否可以在表结构中的“显示 0 到 0 个条目中的 0 个条目”旁边显示“显示条目”下拉列表。我想在底部显示“显示条目”下拉列表以及分页并显示 0 到 0 个条目,共 0 个条目。 提前致谢!!! 图
我不明白当你这样做一连串 .show() 时会发生什么。我也没有编写这段代码,也不知道如何弄清楚这里发生了什么。因此就有了这个问题。 // Remove favorite category
$(document).ready(function(){ $('html').addClass('js'); var contactForm = {
因此,在实现上一个问题的 jQuery 代码后,我注意到以下内容,每当人们添加位于显示较少/显示更多菜单中的产品时,系统会刷新页面,因为它会重新计算价格,因此也会刷新页面。但是当发生这种情况时,菜单会
我已经在 Windows 上设置了 mongodb 64bits。我成功运行了服务器和客户端。 但是当我输入时: show dbs 输出是 local 0.000GB 为什么? show dbs 应
正如标题所说,我有兴趣使用 Show a在我有 Show (a,b) 的情况下. GADT 很容易出现这个问题,如下所示: data PairOrNot a where Pair :: (b,c)
通常 julia> Base.show(io::IO, a::Int) = print(io, "xx") show (generic function with 98 methods) julia>
通常 julia> Base.show(io::IO, a::Int) = print(io, "xx") show (generic function with 98 methods) julia>
我找不到关于 Readline 选项 show-all-if-ambiguous 和 show-all-if-unmodified 之间区别的明确解释,以及是否它们影响不同的事物或相互排斥。关于这个主
我是 BeautifulSoup 的新手,我遇到了一些我不明白的问题,我认为这个问题可能尚未得到解答,但在这种情况下,我找到的答案都没有帮助我。 我需要访问 div 的内部以检索网站的词汇表条目,但是
我已经为 iOS 10 实现了新的小部件,并使用以下代码为其设置高度: @available(iOSApplicationExtension 10.0, *) func widgetActiveDis
克隆远程 git 存储库并发出 git show --show-signature 后,它说签名是好的。然后我更改了一些文件并测试了相同的命令,它仍然说签名是好的。 上面的命令到底检查了什么?验证克隆
我陷入了这个问题,而且我对 Haskell 很陌生,我试图用以下代码完成第一个欧拉问题: main = putStrLn . show . sum $ [3,6..1000]:[5,10..1000]
我有一个独立的 Android 和 iOS 应用程序。 目前正在 Android 上测试推送通知。 我已经使用以下通知键设置了我的 app.json "notification":{ "i
我所说的示例:http://jsfiddle.net/bsnxp/1/ 如果你检查源 .show().clone() display 是 inline-block (它应该是什么)并且 .clone(
我正在使用下面的 jQuery 代码来显示/隐藏网页上的额外文本 jQuery.fn.shorten = function(settings) { var config = { showC
我有一个带有 ng-show 的 div。这个 div 是我创建的自定义指令的包装器。 HTML JS function myDirective() { function doS
我是一名优秀的程序员,十分优秀!