UINavigationItem prompt
@property(nonatomic, copy) NSString *prompt
Discussion of [UINavigationItem prompt]
The default value is nil.
UINavigationItem prompt example.
UIView *viewContainingSpinner;
UIActivityIndicatorView *activityIndicatorView;
UIBarButtonItem *activityButtonItem;
UIBarButtonItem *rightBarButtonItem;
// Configuring the title and the prompt title of the navigation bar
[self.navigationItem setTitle:@"MobileMe"];
[self.navigationItem setPrompt:@"Vérification du compte MobileMe"];
// We will create a UIBarButtonItem that has a custom view (viewContainingSpinner).
// A subview of viewContainingSpinner will be a UIActivityIndicatorView (activityIndicatorView)
// We need to have this "intermediate" view to position the spinner at the right position (the UIBarButtonItem ignores the origin and height of its custom view)
viewContainingSpinner = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 60, 85)];
activityIndicatorView = [[UIActivityIndicatorView alloc] initWithFrame:CGRectMake(20, 0, 20, 20)];
[viewContainingSpinner addSubview:activityIndicatorView];
[activityIndicatorView startAnimating];
[activityIndicatorView release];
activityButtonItem = [[UIBarButtonItem alloc] initWithCustomView:viewContainingSpinner];
self.navigationItem.leftBarButtonItem = activityButtonItem;
[viewContainingSpinner release];
[activityButtonItem release];
// Finally, configuring the right button
rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Enregistrer" style:UIBarButtonItemStylePlain target:nil action:nil];
[rightBarButtonItem setEnabled:NO];
self.navigationItem.rightBarButtonItem = rightBarButtonItem;
[rightBarButtonItem release];
UIActivityIndicatorView *activityIndicatorView;
UIBarButtonItem *activityButtonItem;
UIBarButtonItem *rightBarButtonItem;
// Configuring the title and the prompt title of the navigation bar
[self.navigationItem setTitle:@"MobileMe"];
[self.navigationItem setPrompt:@"Vérification du compte MobileMe"];
// We will create a UIBarButtonItem that has a custom view (viewContainingSpinner).
// A subview of viewContainingSpinner will be a UIActivityIndicatorView (activityIndicatorView)
// We need to have this "intermediate" view to position the spinner at the right position (the UIBarButtonItem ignores the origin and height of its custom view)
viewContainingSpinner = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 60, 85)];
activityIndicatorView = [[UIActivityIndicatorView alloc] initWithFrame:CGRectMake(20, 0, 20, 20)];
[viewContainingSpinner addSubview:activityIndicatorView];
[activityIndicatorView startAnimating];
[activityIndicatorView release];
activityButtonItem = [[UIBarButtonItem alloc] initWithCustomView:viewContainingSpinner];
self.navigationItem.leftBarButtonItem = activityButtonItem;
[viewContainingSpinner release];
[activityButtonItem release];
// Finally, configuring the right button
rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Enregistrer" style:UIBarButtonItemStylePlain target:nil action:nil];
[rightBarButtonItem setEnabled:NO];
self.navigationItem.rightBarButtonItem = rightBarButtonItem;
[rightBarButtonItem release];
Example of [UINavigationItem prompt].
UINavigationBar *bar = picker.navigationBar;
UINavigationItem *navItem = bar.topItem;
navItem.prompt = @"Some new prompt";
UINavigationItem *navItem = bar.topItem;
navItem.prompt = @"Some new prompt";
UINavigationItem prompt example.
self.navigationItem.prompt = NSLocalizedString(@\"Please select the appropriate media type:\", @\"Page Five Prompt\");