0

I am woking on a project where i have to show a custom alert view similar to uiview-as-alertview

I found, that customising UIAlertView is a wrong approach! So the way to achieve it is using UIView, that would Pop-in and Pop-out like UIAlertView using animation.

I have also seen some SOs [question]: How can I customize an iOS alert view? and [question]: UIView Popup like UIAlertView Still i am facing problem, like AlertView not appearing. Can anyone just share some good tutorial on the same.

//Thanks

Community
  • 1
  • 1
ibiren
  • 673
  • 6
  • 25

2 Answers2

0

The system UIAlertView creates its own UIWindow so it can float above your normal UIWindow. You might want to try that approach. If you do, you might find some useful hints in this answer about using extra UIWindows.

Community
  • 1
  • 1
rob mayoff
  • 375,296
  • 67
  • 796
  • 848
  • I subclassed UIView class to draw this menu. Then instantiated it to be displayed over parent viewcontroller. To handle touch events in the parent VC i used Protocol-delegate approach! – ibiren Dec 12 '12 at 10:57
0

You can use a Modal View Controller

A modal view controller is simply a UIViewController class that is presented modally.

To present a view controller in a modal fashion, you can use the method:

- (void)presentModalViewController:(UIViewController *)modalViewController animated:(BOOL)animated;

Change the Frame as a 50% of view and you can apply different Animations to it for representation.

Here are the available modal transition styles

yourModelViewController.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
yourModelViewController.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
yourModelViewController.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
yourModelViewController.modalTransitionStyle = UIModalTransitionStylePartialCurl;

Example Code:

UIViewController *controller = [[MyViewController alloc] init];
controller.frame = yourFrame;
UIViewAnimationTransition trans = UIViewAnimationTransitionCurlUp;
[UIView beginAnimations: nil context: nil];
[UIView setAnimationTransition: trans forView: [self window] cache: YES];
[self.view presentModalViewController: controller animated: NO];
[UIView commitAnimations];
Shamsudheen TK
  • 30,739
  • 9
  • 69
  • 102