我设置UIDatePicker
了一个 cocos2d 场景。(希望它是对的)它工作得很好,直到我必须选择一个日期,所以我滚动选择器,然后它停止的那一刻,它崩溃了,它甚至不调用选择器方法。
CGRect pickerFrame = CGRectMake(0,250,0,0);
UIDatePicker *myPicker = [[UIDatePicker alloc] initWithFrame:pickerFrame];
[myPicker addTarget:self action:@selector(pickerChanged:)
forControlEvents:UIControlEventValueChanged];
//[self.view addSubview:myPicker];
[[[CCDirector sharedDirector] view] addSubview:myPicker];
[myPicker release];
- (void)pickerChanged:(id)sender
{
NSLog(@"value: %@",[sender date]);
}
顺便说一句,我是否正确地将选择器添加到 cocos2d 场景中?