Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I create a custom popup window for iPhone?

I want to create a custom popup window for iPhone which should look like this: enter image description here

What is the most correct way to implement this for iPhone and iPod devices?

like image 309
MainstreamDeveloper00 Avatar asked Jul 17 '13 11:07

MainstreamDeveloper00


4 Answers

The best way to do this is using a UIActionSheet. The code is here:

UIActionSheet *actionSheet = [[UIActionSheet alloc]initWithTitle:@"Share" delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:nil otherButtonTitles:@"Facebook",@"Twitter", nil];
[actionSheet showInView:self.view];

A UIActionSheet comes from the bottom to the top with a certain number of buttons you wish to display. You can also put a cancel button that will automatically dismiss the UIActionSheet.

Here is how it will look like:

enter image description here

like image 167
Abdullah Shafique Avatar answered Oct 15 '22 17:10

Abdullah Shafique


You should try third party classes for custom popup windows. Some of are as follow

1.) CMPopTipView
2.) KBPopupBubble
3.) ADPopupView

like image 20
Bhavin_m Avatar answered Oct 15 '22 17:10

Bhavin_m


There are many way available. I would do this code personally:

// create view popup
UIView *viewPopup = [[UIView alloc] initWithFrame:CGRectMake(x, y, width, height)];
[self.view addSubview:viewPopup];

// create Image View with image back (your blue cloud)
UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(x, y, width, height)];
UIImage *image =  [UIImage imageNamed:[NSString stringWithFormat:@"myImage.png"]];
[imageView setImage:image];
[viewPopup addSubview:imageView];

// create button into viewPopup
UIButton *buttonTakePhoto = [[UIButton alloc] initWithFrame:CGRectMake(x, y, width, height)];
[viewPopup addSubview: buttonTakePhoto];
[buttonTakePhoto setTitle:@"Take Photo" forState:UIControlStateNormal];
[buttonTakePhoto addTarget:self action:@selector(actionTakePhoto) forControlEvents:UIControlEventTouchDown];
[viewPopup addSubview:buttonTakePhoto];

You can animated the Alpha viewPopup when click on the Icon Camera such as enable/disable the viewPopup.

like image 30
Alessandro Pirovano Avatar answered Oct 15 '22 17:10

Alessandro Pirovano


Used third party control, to do this.

Here is the Link you may download this project.

like image 41
Jitendra Avatar answered Oct 15 '22 18:10

Jitendra