1

UIActionSheet 按钮的文本阴影有问题。在 iOS 4.0.2 长字符串被自动截断。在 iOS 4.2 中不,这些文本以较小的字体呈现。但是现在阴影的偏移量被破坏并且变大了。

是否有可能更改/删除 UIActionSheet 的文本阴影。 替代文字

编辑:我不是用 构建 UIActionSheet initWithTitle:,而是用 normal构建 UIActionSheet ,init然后设置所有需要的属性,因为可能的按钮数量是动态的,并且文本不能更改。我已经对其进行了测试initWithTitle:并得到了相同的结果。

4

4 回答 4

2

在 UIActionSheet 中显示之前,您可以参考它来截断您的字符串。

于 2010-12-31T11:22:27.907 回答
1

I can think there are two workarounds for this (although I would not them myself in my application, reason listed below the workarounds):

  • In the first case you access the sublayers of UIActionSheet, get the labels, change the shadowOffset and shadowColor before presenting the actionsheet.
  • Secondly you can initialize the actionsheet with blank titles and add your own labels as subviews on the actionsheet at right places. (More tricky then the first approach).

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.

于 2011-01-04T11:27:25.297 回答
0
于 2010-12-27T14:18:17.350 回答
0

这似乎在 4.30 中得到修复。我发现无法在 4.2x 中修复它。

于 2011-04-11T13:26:08.220 回答