UITextField with inputView does not work on some iOS 8 simulators

Using Xcode 6 with iOS 8 SDK and the minimum value supported as iOS 7.

This code does not work on iPhone 5s 8.0, iPhone 6, iPhone 6 Plus, but it works on iPhone 5 8.0 and iPhone 4s 8.0.

It has one text box. The text box has an inputView and an inputAccessoryView to display the date picker and toolbar with a single button.

I have done enough to demonstrate this problem. On these higher model simulators, only the toolbar is displayed, not the assembler.

Is this a bug in the simulator or a change in iOS 8 that still works?

#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    UIPickerView *pickerView = [[UIPickerView alloc] initWithFrame:CGRectMake(0, 43, 320, 480)];
    pickerView.delegate = self;
    pickerView.dataSource = self;
    [pickerView setShowsSelectionIndicator:YES];
    pickerView.backgroundColor = [UIColor whiteColor];
    _textField.inputView = pickerView ;
    _textField.delegate = self;

    UIToolbar *toolbar = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 0, 320, 56)];
    toolbar.barStyle = UIBarStyleBlackOpaque;
    [toolbar sizeToFit];

    NSMutableArray *barItems = [[NSMutableArray alloc] init];
    UIBarButtonItem *flexSpace = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:self action:nil];
    [barItems addObject:flexSpace];
    UIBarButtonItem *doneBtn = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:nil];
    [barItems addObject:doneBtn];
    [toolbar setItems:barItems animated:YES];

    _textField.inputAccessoryView = toolbar;


}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView
{
    return 1;
}

- (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component
{
    return 3;
}

@end
+4
3

iOS Simulator. iOS Simulator > .

+4

, , , + k "" > "" > " " Mac, .

0

. .

0

All Articles