Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • UIAlertController as an action sheet in iOS8 and above.

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 456
    Comment on it

    Now you can use UIAlertController as an actionsheet in iOS 8 and above versions. Here is an example of it:-

        UIAlertController * view=   [UIAlertController
                                     alertControllerWithTitle:@"Sample"
                                     message:@"Welcome"
                                     preferredStyle:UIAlertControllerStyleActionSheet];
    
       UIAlertAction* okBtn = [UIAlertAction
                            actionWithTitle:@"OK"
                            style:UIAlertActionStyleDefault
                            handler:^(UIAlertAction * action)
                            {
                                //Do some thing here
                                [view dismissViewControllerAnimated:YES completion:nil];
    
                            }];
       UIAlertAction* cancelBtn = [UIAlertAction
                                actionWithTitle:@"Cancel"
                                style:UIAlertActionStyleDefault
                                handler:^(UIAlertAction * action)
                                {
                                    [view dismissViewControllerAnimated:YES completion:nil];
    
                                }];
    
    
       [view addAction:okBtn];
       [view addAction:cancelBtn];
       [self presentViewController:view animated:YES completion:nil];
    
    

    Happy Coding!!!

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: