HelloWorld
HelloWorld

Reputation: 7286

How to popup a view from bottom?

When click a button,I want to popup a view form bottom,like this!

http://i40.tinypic.com/2lapxdi.png

Any help is welcome,thanks.

Upvotes: 0

Views: 1684

Answers (2)

Eric Schweichler
Eric Schweichler

Reputation: 1092

If you want to reproduce what is seen in the screenshot you linked you can also put a picker in a UIActionSheet like so:

UIActionSheet datePickerSheet = [[UIActionSheet alloc] initWithTitle:NSLocalizedString(@"Select     Date",@"Selecte Date")
                                              delegate:self
                                     cancelButtonTitle:NSLocalizedString(@"Done",@"Done")
                                destructiveButtonTitle:NSLocalizedString(@"Cancel",@"Cancel")
                                     otherButtonTitles:nil];
// Add the picker
datePicker = [[UIDatePicker alloc] initWithFrame:CGRectMake(0,185,0,0)];

[datePicker addTarget:self action:@selector(dateDidChange) forControlEvents:UIControlEventValueChanged];

[datePickerSheet addSubview:datePicker];
[datePickerSheet showInView:self.view];
[datePickerSheet setBounds:CGRectMake(0,0,320, 700)];



[datePicker release];
[datePickerSheet release];

Upvotes: 1

Ian Henry
Ian Henry

Reputation: 22403

Use the presentModalViewController:animated: method. See the docs for details on its use.

Upvotes: 1

Related Questions