簡體   English   中英

如何在同一個類中的另一個方法中使用CGPoint值

[英]how can I use a CGPoint value from one method in another within the same class

抱歉,這聽起來很簡單。 我是Cocos2d和Obj-C的新手。 我想將一種方法中的精靈的CGPoint值與另一種方法中計算出的值進行比較。 在同一個類中,如何從一個方法訪問另一個方法的值?

要么將其傳遞到方法中,要么聲明一個私有屬性來保存該值:

@property (nonatomic, assign) CGPoint myCGPoint;

然后在實現文件中將其合成:

@synthesize myCGPoint;

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM