Detecting button click with UIAlertView

后端 未结 6 1260
难免孤独
难免孤独 2021-01-01 12:10

I am trying to call and alert when a button is pressed. i use this :

-(IBAction)Add { 
    UIAlertView *alert = [[UIAlertView alloc] initWithTitle: @\"add bu         


        
6条回答
  •  温柔的废话
    2021-01-01 12:41

    To detect the button clicks the alert view must have an associated delegate, e.g.

    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"add button pressed"
                                                    message:@"Add to record"
                                                   delegate:self    // <------
                                          cancelButtonTitle:@"Cancel"
                                          otherButtonTitles:@"OK", nil];
    

提交回复
热议问题