UIActionsSheet文字阴影问题
我对 UIActionSheet 按钮的文本阴影有疑问。在 iOS 4.0.2 中,长字符串会被自动截断。在 iOS 4.2 中,这些文本不会以较小的字体显示。但现在阴影的偏移已损坏且太大。
是否可以更改/删除 UIActionSheet 的文本阴影。
编辑:我不是使用 initWithTitle:
构建 UIActionSheet,而是使用正常的init
并随后设置所有需要的属性,因为可能的按钮数量是动态的并且文本无法更改。我用 initWithTitle:
对其进行了测试,并得到了相同的结果。
I have a problem with the text shadow of the UIActionSheet buttons. At iOS 4.0.2 long string were truncated automatically. No at iOS 4.2 these texts are presented with a smaller font. But now the offset of the shadow is corrupted and to big.
Is there a possibility to change/remove the text shadow of the UIActionSheet.
EDIT: I'm building the UIActionSheet not with initWithTitle:
, but with the normal init
and sets all needed properties afterwards because the number of possible buttons is dynamic and the texts cannot be change. I've tested it with initWithTitle:
and got the same results.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您可以参考此来截断您的字符串在将其显示在 UIActionSheet 中之前。
You can refer this to truncate your string before displaying it in a UIActionSheet.
我认为有两种解决方法(尽管我自己不会在我的应用程序中使用它们,原因在解决方法下面列出):
shadowOffset 和
shadowColor
在呈现操作表之前。现在,第一种方法非常危险,因为苹果可以在将来的更新中更改 UIActionSheet 的层结构,因此您的应用程序可能会崩溃并且不会给出良好的结果。
仅当您可以计算出应放置标签的确切帧以使它们看起来不错时,继续使用第二种方法才是好的。但在您的情况下,按钮的数量也会有所不同,因此这种方法最初需要花费大量时间才能正常工作。
因此,在将字符串设置为按钮标题之前,我会先截断字符串。
不确定这会有多大帮助。但我确信在将字符串设置为标题之前截断字符串是最好的选择。
I can think there are two workarounds for this (although I would not them myself in my application, reason listed below the workarounds):
shadowOffset
andshadowColor
before presenting the actionsheet.Now the first approach is very risky as the layer structure of UIActionSheet can be changed by apple in future updates, hence your application may break and would not give good results.
Continuing with second approach is good only when you can calculate the exact frames where you should put your lebels so that they look good. But in your case the number of buttons would also vary, so this approach will take a lot of time initially to get the things working.
Hence, I would go for truncating the strings before I set them as the title of buttons.
Not sure how much would this help. But I am sure that truncating strings before setting them as titles is the best option.
您是否在执行任何非默认操作来显示文本?
如果您只使用
UIActionSheet-initWithTitle:...
您应该向 Apple 编写错误报告。或者将文本缩短为“法兰克福国际 (FRA), DE”;)
are you doing anything non default for displaying the text?
If you only use
UIActionSheet-initWithTitle:…
you should write a bug report to Apple.OR shorten the text to "Frankfurt International (FRA), DE" ;)
这似乎在 4.30 中得到了修复。我发现在 4.2x 中没有办法修复它。
This appears to be fixed in 4.30. I found no way of fixing it in 4.2x.