objective-c - UIColor 颜色WithPatternImage : transparency issues in UITableView's separatorColor

标签 objective-c ios user-interface ios5 uicolor

我在设置我的图案化 UIColor 时遇到了麻烦。在 iOS 5 中一切都很好,但在 iOS 4.3 中我遇到了问题。我添加了一张图片以便更好地理解。我已经用 Google 搜索了一下,发现答案可能是将 opaque 属性设置为 NO。但是我已经设置了每个 view, contentView, backgroundView, tableViewCell 它是 opaque 值为 NO

You can see that the separator color is black, where the image has of the pattern has transparency

可以看到分隔符颜色为黑色,其中图案的图像具有透明度

最佳答案

这似乎是 iOS 4.3 中的错误,他们已在 5.0 中修复。

要让它在 4.3 上运行,在将 View 的背景颜色设置为图案图像后,您需要将 View 和图层设置为不透明,如下所示:

UIImage* pattern = [UIImage imageNamed:@"translucentPatternImage.png"];
view.backgroundColor = [UIColor colorWithPatternImage:pattern];
[view.layer setOpaque:NO];
view.opaque = NO;

关于objective-c - UIColor 颜色WithPatternImage : transparency issues in UITableView's separatorColor,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8325173/

相关文章:

iphone - 苹果商店接受,允许下载布局提示到 iphone?

ios - 从 NSDictionary 获取值

c++ - 在 C++\Win32(不是 MFC 或 CLI)中编写类似按钮的控件?

objective-c - SMJobRemove 成功,但未删除 plist 和 helper 工具

ios - 使用 Fabric SDK 的 Twitter 登录按钮

iOS Xamarin 将 tabBar 推到导航 Controller 上

java - 我需要如何实现 GridBagLayout

python - 组织 GUI 应用程序

objective-c - 我们什么时候在 Objective-C 中使用 "->"?

iphone - UIActivityIndi​​catorView 未在 UIAlertView 上正确显示