Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<pre><code> - (void)viewDidLoad { [self createAccessoryView]; [textField setDelegate:self]; [textField setKeyboardType:UIKeyboardTypeDefault]; [textField setInputAccessoryView:fieldAccessoryView]; } - (void)createAccessoryView { CGRect frame = CGRectMake(0.0, self.view.bounds.size.height, self.view.bounds.size.width, 44.0); fieldAccessoryView = [[UIToolbar alloc] initWithFrame:frame]; fieldAccessoryView.barStyle = UIBarStyleBlackOpaque; fieldAccessoryView.tag = 200; [fieldAccessoryView setBarStyle:UIBarStyleBlack]; UIBarButtonItem *spaceButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil]; UIBarButtonItem *doneButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(done:)]; UISegmentedControl* segmentedControl = [[UISegmentedControl alloc] initWithItems:[NSArray arrayWithObjects:NSLocalizedString(@"Previous", @""), NSLocalizedString(@"Next", @""), nil]]; [segmentedControl addTarget:self action:@selector(segmentAction:) forControlEvents:UIControlEventValueChanged]; segmentedControl.segmentedControlStyle = UISegmentedControlStyleBar; [segmentedControl setMomentary:YES]; UIBarButtonItem *segmentButton = [[UIBarButtonItem alloc] initWithCustomView:segmentedControl]; [fieldAccessoryView setItems:[NSArray arrayWithObjects:segmentButton, spaceButton, doneButton, nil] animated:NO]; [segmentButton release]; [spaceButton release]; [doneButton release]; [segmentedControl release]; } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload