iOS 응용 프로그램을 만들고 점수가 100에 도달하면이 경고가 표시되고 모두 제대로 작동하지만 버튼 (공유, 사과,이 앱의 등급 지정)이 작동합니다. 나는 등 링크를 추가 할 위치에 상관 싶은 것이알림보기 버튼
- (void) buttonAction {
counter++;
if(counter == 100)
[self showAlert];
}
- (void) showAlert {
UIAlertView *alert = [[UIAlertView alloc]
initWithTitle:@"hello"
message:@"whats you name"
delegate:nil
cancelButtonTitle:@"Dismiss"
otherButtonTitles:@"share", @"apple" , @"rate this app", nil];
-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
if (buttonIndex == 0) { // means share button pressed
// write your code here to do whatever you want to do once the share button is pressed
}
if(buttonIndex == 1) { // means apple button pressed
// write your code here to do whatever you want to do once the apple button is pressed
}
// and so on for the last button
}
[alert show];
}
-(IBAction)plus {
counter=counter + 1;
count.text = [NSString stringWithFormat:@"%i",counter];
if(counter == 100)
[self showAlert];
}
-(IBAction)zero {
counter=0;
count.text = [NSString stringWithFormat:@"%i",counter];
}
- (void)viewDidLoad {
counter=0;
count.text = @"0";
[super viewDidLoad];
}
는
UIAlertView *alert = [[UIAlertView alloc]
initWithTitle:@"hello"
message:@"whats you name"
delegate:self
cancelButtonTitle:@"Dismiss"
otherButtonTitles:@"share", @"apple" , @"rate this app", nil];
[alert show];
다음 코드에서 다음과 같은 방법을 추가 ... 당신이
나는 당신이 원하는 것을 이해하지 못합니다. –
@PrasadG 버튼을 어떻게 만들 수 있는지에 대한 실제적인 방법 (예 : 사과 등 사과 사이트로 이동). – Picm