Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/sharepoint/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
IOS/Objective-C:带参数的共享实例方法_Ios_Lazy Loading - Fatal编程技术网

IOS/Objective-C:带参数的共享实例方法

IOS/Objective-C:带参数的共享实例方法,ios,lazy-loading,Ios,Lazy Loading,嗨,我有一个班级,我正在懒洋洋地把它作为一个分享站。我希望能够调用类中需要输入变量的方法,但以下语法不起作用。它说没有这样的属性,但我从接口复制了该属性 下面是不起作用的代码 int myPoints = 200; //myStatusLevel is a method in ManagePoints that takes mypoints as an input // its signature is (int)myStatusLevel: (int) points; //the follow

嗨,我有一个班级,我正在懒洋洋地把它作为一个分享站。我希望能够调用类中需要输入变量的方法,但以下语法不起作用。它说没有这样的属性,但我从接口复制了该属性

下面是不起作用的代码

int myPoints = 200;
//myStatusLevel is a method in ManagePoints that takes mypoints as an input
// its signature is (int)myStatusLevel: (int) points;
//the following line gives error prperty myStatusLevel not found
int myStatusLevel =[ManagePoints sharedInstance].myStatusLevel:myPoints; 

可以这样做吗?如果可以,正确的语法是什么?提前感谢您的建议。

如果ManagePoints中有具有以下签名的方法:

-intmyStatusLevel:intpoints

然后您应该能够调用该函数并传递参数

您需要使用方括号:

int myStatusLevel=[[ManagePoints sharedInstance]myStatusLevel:myPoints]