ios objective-c 常量 CGFloat *

标签 ios objective-c pointers nsarray cgfloat

打电话的时候

setLineDash:(nullable const CGFloat *) count:(NSInteger) phase:(CGFloat)

通过将@[@1.0,@2.0] 传递为 (nullable const CGFloat *) 的方法

UIBezierPath *path = [self drawLine:start ended:ended];
[path setLineDash:@[@1.0, @2.0] count:2 phase:0.0];

我一直收到这个错误;

Implicit conversion of an Objective-C pointer to 'const CGFloat * _Nullable' (aka 'const double *') is disallowed with ARC

有什么建议吗?在此处传递的正确参数是什么。

表示赞赏。

最佳答案

试试这个

CGFloat dash_pattern[]={1.0,2.0};
[path setLineDash:dash_pattern count:2 phase:0.0];

关于ios objective-c 常量 CGFloat *,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55017582/

相关文章:

c++ - 函数指针的取消引用是如何发生的?

c - 使用指针模拟简单函数的引用传递,但没有输出

iphone - 如果(tableView==self.searchDisplayController.searchResultsTableView)失败

iphone - 另一个 Xcode 项目中的 undefined symbol

ios - 联系人排序类似于 viber iOS App

ios - 我不再使用的库在启动时使应用程序崩溃。如何彻底去除? Xcode/swift

c - 指针类型的使用

ios - 从函数返回不同类型的数组内容

ios - 在 parse.com 的 ios 中使用 google plus 登录

ios - 具有复杂触摸代码的 View 是否应该有自己的 View Controller ?