Skip to content

Helper class depending on WYPopover to display a popover with choices

License

Notifications You must be signed in to change notification settings

evands/ESPopoverWithChoices

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

59 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ESPopoverWithChoices

Relatively simple helper class depending on WEPopover to display a popover with choices. Simply include the classes within this repository and within the WEPopover submodule (as well as the associated resources) in your own project.

- (void)displayChoices:(UIBarButtonItem *)sender
{
	ESPopoverChoicesSelectionController *contentViewController = [[ESPopoverChoicesSelectionController alloc] initWithStyle:UITableViewStylePlain];
	contentViewController.delegate = self;
	contentViewController.choices = [NSArray arrayWithObjects:
					[ESPopoverChoice popoverChoiceWithName:@"Choice One" value:[NSNumber numberWithInteger:EnumValueForChoiceOne]],
					[ESPopoverChoice popoverChoiceWithName:@""Choice Two" value:[NSNumber numberWithInteger:EnumValueForChoiceTwo]],
					[ESPopoverChoice popoverChoiceWithName:@""Choice Three" "value:[NSNumber numberWithInteger:EnumValueForChoiceThree]],
									 nil];

	self.popoverController = [[[WEPopoverController alloc] initWithContentViewController:contentViewController] autorelease];
	[self.popoverController presentPopoverFromBarButtonItem:sender 
								   permittedArrowDirections:UIPopoverArrowDirectionUp
												   animated:YES];
	[contentViewController release];
}

with a simple delegate handler method of:

- (void)popoverChoicesSelectionController:(ESPopoverChoicesSelectionController *)controller didSelectChoice:(ESPopoverChoice *)choice
{
	if (choice) {
		NSInteger theChoiceEnumValue = [choice.value intValue];
	
		. . .
	}
				
	[self.popoverController dismissPopoverAnimated:YES];
	self.popoverController = nil;
}

About

Helper class depending on WYPopover to display a popover with choices

Resources

License

Stars

Watchers

Forks

Packages

No packages published