2014-10-08 18 views

Odpowiedz

14

Tak, dostałem ten problem. Opracowałem swój kod w iOS7, ale musiałem zrobić to również z iOS 8. Więc natknąłem się na This link. Mam moje rozwiązanie w następujący sposób:

Podczas pracy z iOS7 UIAlertView działa dobrze, ale jeśli pracujesz z iOS8, musisz użyć UIAlertController. Użyj tego rodzaju kodu:

if(SYSTEM_VERSION_LESS_THAN(@"8.0")) 
{ 
    alert = [[UIAlertView alloc] initWithTitle:@"Warning" message:@"Invalid Coupon." delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil]; 
     [alert show]; 
} 
     else 
     { 
     UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"Warning" message:@"Invalid Coupon." preferredStyle:UIAlertControllerStyleAlert]; 


     UIAlertAction *okAction = [UIAlertAction 
            actionWithTitle:NSLocalizedString(@"OK", @"OK action") 
            style:UIAlertActionStyleDefault 
            handler:^(UIAlertAction *action) 
            { 

            }]; 

     [alertController addAction:okAction]; 

     [self presentViewController:alertController animated:YES completion:nil]; 
    } 

Mam nadzieję, że to ci pomoże.

+0

Dzięki @iAnurag: D – Salmo

+0

Witamy. miło, że mogłem pomóc – iAnurag

Powiązane problemy