1
我正在使用cocos2d,並且我想要一個UIAlertView彈出如果CCMenuItemFont文本被點擊。我可以讓alertView彈出,但是我想要在文本被點擊之後。這裏是我的代碼 INITUIAlertView如果CCMenuItemFont(文本)挖掘
rate = [CCMenuItemFont itemFromString:@"Rate App" target:self selector:@selector(rateIsTapped:clickedButtonAtIndex:)];
rate.position = ccp(240, 160);
[self addChild:rate];
-(void)rateTapped:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
rateView = [[UIAlertView alloc] initWithTitle:@"Like This App?" message:@"Rate it on the App Store!" delegate:self cancelButtonTitle:@"No thanks" otherButtonTitles:@"Sure, I'll rate it!", nil];
[rateView show];
[rateView autorelease];
[defaults setBool:YES forKey:@"rate"];
if (buttonIndex == 0) {
//[alertView collapse];
}
if (buttonIndex == 1) {
NSURL *url = [NSURL URLWithString:@"LINK TO RATE IN APP STORE"];
[[UIApplication sharedApplication] openURL:url];
}
}
謝謝,但仍然沒有做任何事情,當我點擊模擬器上的費率應用程序。但沒有崩潰 – Joethemonkey101 2011-02-08 00:17:22