0

I am trying to developing popup view, So I have decided If I develop tableview menu within ActionSheet , then its looking good for my application with background blurry effects also automatically will add by UIActionSheet. Please help me and post some code and ideas. Below I have give one example for what I am expecting

--------------------------------------------
|                                           |                   
|  Icon Title            checkmark          |
| ----------------------------------------- |
|                                           |                   
|  Icon Title            checkmark          |
| ----------------------------------------- |
|                                           |                   
|  Icon Title            checkmark          |
| ----------------------------------------- |
|                                           |                   
|  Icon Title            checkmark          |
--------------------------------------------

Menu button click to show above action sheet and tableview cell did select to hide.

AnswerMe
  • 189
  • 1
  • 1
  • 10
  • http://stackoverflow.com/questions/29226050/how-can-i-customize-uialertaction-in-uialertcontroller-for-ios8 – Ajith Renjala Aug 21 '15 at 12:07
  • Thank you for share ur link. but there UIAlert customization, my questions is totaly different @Ajit – AnswerMe Aug 21 '15 at 12:09
  • Well, you mentioned `UIActionSheet` & it is deprecated in iOS 8. To create and manage action sheets in iOS 8 and later, instead use `UIAlertController` with a preferredStyle of `UIAlertControllerStyleActionSheet`. – Ajith Renjala Aug 21 '15 at 12:18
  • Alright I understand. But give me some samples! Its not enough for me bcz i am new for iOS – AnswerMe Aug 21 '15 at 12:20

1 Answers1

0

Here is a sample code to present action sheet with an image using UIAlertController

  UIAlertController *alertController = [UIAlertController
      alertControllerWithTitle:@"Title"
                       message:@"message"
                preferredStyle:UIAlertControllerStyleActionSheet];

  UIAlertAction *tapAction = [UIAlertAction
      actionWithTitle:@"Title"
                style:UIAlertActionStyleDefault
              handler:^(UIAlertAction *action){
                  // add code to make something happen once tapped
              }];
  // add image & appears on left side.
  UIImage *accessoryImage = [UIImage imageNamed:@"image.png"];
  [tapAction setValue:accessoryImage forKey:@"image"];

  [alertController addAction:tapAction];

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

Note: here adding an image works in iOS 8 by using KVC (see here) ; property is not exposed. So, this may not be available in subsequent updates.

To customise it as per your need, I'd suggest you to build your own custom action sheet similar to UIActionSheet. Use a custom view/tableview and then, apply UIVisualEffect plus animation.

Ajith Renjala
  • 4,934
  • 5
  • 34
  • 42