我一直在运行一个很好的Cocos2d教程来实现iAds并接近实现它(我从控制台获得iAd消息)......
我一直回到这个警告:
CCGLView *eaglView = [[CCDirector sharedDirector] openGLView];
Run Code Online (Sandbox Code Playgroud)
"找不到实例方法'-openGLView'......"
我认为这与从调用GLView到CCGLView(cocos2d)的转换有关...
我在Linux代码中看到了一堆名为__foo的函数.双下划线代表什么,何时应该使用?
我用cocos2d创建了一个新项目,然后创建了一个图层和一个精灵.我正在尝试将动画应用到我的精灵中,我发现了一些关于它的示例.但我不明白之间的差别CCAnimation和CCAnimate,所以我还没有应用任何动画,我还没有精灵.
这两者有什么区别,它们的真正含义是什么?怎么用?
任何人都可以解释一下吗?请帮我.
我有一个名为dateSelectViewController的方法在我的.h文件中声明为协议:
@class DateSelectViewController;
@protocol DateSelectViewControllerDelegate
- (void)dateSelectViewController:(DateSelectViewController *)sender
theDate:(id)stringDate;
@end
Run Code Online (Sandbox Code Playgroud)
在协议下面,我宣布一个代表:
@property (nonatomic, weak) id <DateSelectViewControllerDelegate> delegate;
Run Code Online (Sandbox Code Playgroud)
在实现文件中,我合成了委托,并在我的视图中按下完成按钮时向委托发送消息:
- (IBAction)DonePressed:(id)sender {
NSDate *chosen = [datePicker date];
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setDateFormat:@"MM/dd/yyyy"];
NSString *formatedDate = [formatter stringFromDate:chosen];
//sending a message to the delegate
[self.delegate dateSelectViewController:self theDate:formatedDate];
[self.navigationController popViewControllerAnimated:YES];
}
Run Code Online (Sandbox Code Playgroud)
在被委派给的.h文件中,我正在导入委托人.h文件.在.m文件中我符合协议:
@interface MakePlantTVC ()<DateSelectViewControllerDelegate>
- (void)dateSelectViewController:(DateSelectViewController *)sender
theDate:(id)stringDate
{
self.displayDate.text = stringDate;
NSLog(@"delegate working");
}
Run Code Online (Sandbox Code Playgroud)
出于某种原因,这一点正在发挥作用.当在我的委托者类中按下完成按钮时,该按钮会按预期执行并弹出视图控制器,但就像消息永远不会发送给代理一样.起初我以为我可以向nil发送消息,但是它的类型为id,所以情况应该不是这样.为什么没有发送消息?
如何在GameConfig.h中存储CCLabelTTF颜色,如:
#define kGameLabelColor ccc3(79,71,59);
Run Code Online (Sandbox Code Playgroud) 在过去,我总是看到财产被称为position并且positionInPixels是相同的.这一次position * 2 == positionInPixels.谁能告诉我这两个属性之间有什么区别,或者它们的价值会有什么不同?
ios ×5
iphone ×3
objective-c ×2
c ×1
coding-style ×1
delegates ×1
iad ×1
label ×1
linux ×1
protocols ×1