iphone - 问题在 -[CALayer setBorderColor :]

标签 iphone iphone-sdk-3.0 uitextview

我想在我的 TextView 周围有边框;为此,我做了以下工作:

textView.layer.borderWidth = 5.0f;
textView.layer.borderColor = [UIColor grayColor];   

我收到以下警告:

warning: passing argument 1 of 'setBorderColor:' from incompatible pointer type

更新1:我的边框不可见

最佳答案

您的问题是 -[CALayer setBorderColor:] 采用 CGColorRef 类型的对象。您需要做的是将颜色对象转换为符合:

textView.layer.borderColor = [UIColor grayColor].CGColor;

希望对您有所帮助!

关于iphone - 问题在 -[CALayer setBorderColor :],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4373925/

相关文章:

ios - UITextView setSelectedRange 更改可编辑属性

ios - UITextview 文本未在初始 View 上垂直居中

ios - UIScrollView 以编程方式滚动

iphone - deleteItemsAtIndexPaths 中的 UICollectionView 断言失败

iphone - 附件 Action segue (UITableViewController)

iphone - iAd加载失败时不隐藏?

android - 是否有适用于 Android 和 iPhone 的框架

iPhone创建精简版

iPhone,如何修复此警告 : '-respondsToSelector:' not found in protocol(s)

iphone - 如何下载 PDF 并将其存储在 iPhone 本地?