You can directly set the collection for value helps for phone title, currency title, and address title types.
// create the phone number cell MAFPhoneNumberTableViewCell* cellPhoneNumber = [self.mediator getPhoneNumberTableViewCell]; // add/set custom phone types NSArray* phoneTypes = [[[NSArray alloc] initWithObjects:NSLocalizedString(@"SAP Phone",@"SAP Phone"), NSLocalizedString(@"Mobile 1",@"Mobile 1"), nil] autorelease]; cellPhoneNumber.phoneTypes = phoneTypes;
// MAFValueHelpMediatorDelegate implementation - (void)valueHelpMediator:(MAFValueHelpMediator *)sender requestsDisplayOfValueHelpController:(MAFValueHelpController *)controller requestor:(UIView *)requestor { if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad){ // iPad specific (use PopOver) UINavigationController* ncCurrencySelector = [[UINavigationController alloc] initWithRootViewController:controller]; UIPopoverController* pcCurrencySelector = [[UIPopoverController alloc] initWithContentViewController:ncCurrencySelector]; pcCurrencySelector.popoverContentSize = CGSizeMake(350, 500); CGRect rectTrans = [requestor.superview convertRect:requestor.frame toView:self.view]; [pcCurrencySelector presentPopoverFromRect:rectTrans inView:self.view permittedArrowDirections:UIPopoverArrowDirectionLeft | UIPopoverArrowDirectionRight animated:TRUE]; // release controllers appropriately // … } }
You can avoid the bridging functionality of the MAFValueHelpMediator by directly setting your custom accessor delegates on the locale-aware controls. By default, the mediator plays the role of the accessor delegate toward locale-aware controls. The accessor delegates are always called back when an action is triggered on the control itself, for example, editing started, ended, or when a value help is requested. These messages contain the value help collection to show as well, and no mediator is used because you set your custom MAFValueHelpAccessorDelegate for the control; however, you must present the value help collection appropriately.
// MAFValueHelpAccessorDelegate implementations - (void) valueHelpAccessor:(id<MAFValueHelpAccessor>)sender requestSelectionForKey:(NSString*)key withValueHelpCollection:(id<MAFValueHelpCollection>)collection andValueHelpTitle:(NSString*)title;