Ich habe Custom Input Accessory View implementiert es funktionierte gut bis iOS 10.3.1. Aber es ist nicht in iOS 11 Beta sichtbar.Custom Keyboard InputAccessoryView nicht sichtbar in iOS 11
Hat jemand dieses Problem?
Ich habe Custom Input Accessory View implementiert es funktionierte gut bis iOS 10.3.1. Aber es ist nicht in iOS 11 Beta sichtbar.Custom Keyboard InputAccessoryView nicht sichtbar in iOS 11
Hat jemand dieses Problem?
Die Frage, die Sie stellen, hat nicht viel Detail. Aber ich hatte das gleiche Problem, wenn ich eine inputAccessoryView und eine benutzerdefinierte inputView für das Textfeld verwendete.
Und löste dies auf iOS11, indem Sie die authorsizingMask der benutzerdefinierten inputView auf .flexibleHeight setzen.
yourCustomInputView.autoresizingMask = .flexibleHeight
Hoffentlich löst dies das Problem. Wenn nicht, vielleicht etwas mehr Informationen zur Verfügung stellen?
Hier ist, wie ich den Eingang Zubehör hinzufügen, einhüllen dies von mehr Hilfe ist (als Erweiterung von Textfeld):
public extension UITextField {
public func addToolbarInputAccessoryView(barButtonItems: [UIBarButtonItem],
textColour: UIColor,
toolbarHeight: CGFloat = 44,
backgroundColour: UIColor = .white) {
let toolbar = UIToolbar()
toolbar.frame = CGRect(x: 0, y: 0, width: bounds.width, height: toolbarHeight)
toolbar.items = barButtonItems
toolbar.isTranslucent = false
toolbar.barTintColor = backgroundColour
toolbar.tintColor = textColour
inputAccessoryView = toolbar
}
}
Und dann auf das inputView (nicht die inputAccessoryView), verwendete ich zum Beispiel eine Datumsauswahl - stellen Sie lediglich sicher, dass die Autoresierungsmaske der Datumsauswahl auf eine flexible Höhe eingestellt ist.
Ich hatte das gleiche Problem und diese Lösung hat nicht für mich funktioniert. Außerdem sehe ich nur das Problem auf iPads, andere Geräte sind in Ordnung, so scheint es seltsam, dies auf ipads zu tun – user2843570
Diese Lösung hat auch nicht für mich funktioniert. Ich sehe das Problem auf dem iPhone. – Ruchi
Beta 3 hat dieses Problem gelöst. – Ruchi
Beta 3 ist gerade herausgekommen und einige Leute sagten, dass es das Problem löste, aber für mich tat es nicht.
Allerdings habe ich versucht, die Zubehöransicht auf etwas Dummes zu setzen (100pxls hoch) und entdeckte, dass die Undo/Redo/Paste-Leiste auf den iPads falsch über meiner Zubehörleiste saß. So habe ich den folgenden Code von Apples Bar loszuwerden (es war für meine benutzerdefinierten Picker sowieso sinnlos) und das Problem ging
Hoffnung weg hilft dies jemand
- (void)textFieldDidBeginEditing:(UITextField*)textField
{
UITextInputAssistantItem* item = [textField inputAssistantItem];
item.leadingBarButtonGroups = @[];
item.trailingBarButtonGroups = @[];
}
Ich habe das gleiche Problem habe und ich habe herausgefunden, dass bottom
alle das Entfernen top
, leading
, training
, left
, right
Einschränkungen für die Ansicht, die zugewiesen wird accessoryView
es gelöst.
PSA: Wenn Sie eine UIToolbar als benutzerdefinierte Ansicht verwenden, ist sie derzeit in iOS 11 GM defekt. Anstatt Ihre Haare zu verlieren, um es zu reparieren, ändern Sie es einfach zu UIView. Sie werden den Unschärfeeffekt verlieren, aber es wird funktionieren.
Das hat mir so viel Zeit erspart, vielen Dank! – LulzCow
UIToolBar ist in iOS 11 defekt. Aber Sie können die gleiche Sache mit UIView als InputAccessoryView erhalten. Beispielcode-Ausschnitt hier:
CGFloat width = [[UIScreen mainScreen] bounds].size.width;
UIView* toolBar = [[UIView alloc] initWithFrame:CGRectMake(0.0f,0.0f, width, 44.0f)];
toolBar.backgroundColor = [UIColor colorWithRed:0.97f green:0.97f blue:0.97f alpha:1.0f];
UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(20.0 , 0.0f, width, 44.0f)];
[titleLabel setFont:[UIFont fontWithName:@"Helvetica" size:13]];
[titleLabel setBackgroundColor:[UIColor clearColor]];
[titleLabel setTextColor:[UIColor redColor]];
[titleLabel setText:@"Title"];
[titleLabel setTextAlignment:NSTextAlignmentLeft];
[toolBar addSubview:titleLabel];
UIButton *doneBtn = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[doneBtn setTitle:@"Done" forState:UIControlStateNormal];
doneBtn.tintColor = [UIColor colorWithRed:(float)179/255 green:(float)27/255 blue:(float)163/255 alpha:1];
[doneBtn.titleLabel setFont:[UIFont fontWithName:@"Helvetica" size:16]];
[doneBtn addTarget:self action:@selector(btnTxtDoneAction) forControlEvents:UIControlEventTouchUpInside];
[doneBtn setFrame:CGRectMake(width-70, 6, 50, 32)];
[toolBar addSubview:doneBtn];
[toolBar sizeToFit];
txtMessageView.inputAccessoryView = toolBar;
Hope this Hilfe .. :)
Um das inputAccessoryView
Problem in iOS 11 für UITextField
und UITextView
zu vermeiden, verwenden Sie einfach den folgenden Code:
UIView *inputView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 150)];
self.monthPickerView = [[UIPickerView alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 150)];
self.monthPickerView.backgroundColor = [UIColor whiteColor];
self.monthPickerView.delegate = self;
self.monthPickerView.dataSource = self;
[inputView addSubview:self.monthPickerView];
cell.monthTextField.inputView = inputView ;
self.monthTextField.inputAccessoryView = [self doneButtonAccessoryView];
// doneButtonAccessoryView Method
-(UIToolbar*)doneButtonAccessoryView
{
UIToolbar *kbToolbar = [[UIToolbar alloc] init];
[kbToolbar sizeToFit];
[kbToolbar setBarTintColor:[UIColor whiteColor]];
UIBarButtonItem *doneButton = [[UIBarButtonItem alloc] initWithTitle:@"Done"
style:UIBarButtonItemStyleDone target:self
action:@selector(doneClicked)];
UIBarButtonItem *cancelButton = [[UIBarButtonItem alloc] initWithTitle:@"Cancel"
style:UIBarButtonItemStyleDone target:self
action:@selector(cancelClicked)];
NSDictionary *attrDict;
attrDict = [NSDictionary dictionaryWithObjectsAndKeys:
[UIFont fontWithName:@"Helvetica-Bold" size:16.0], NSFontAttributeName, nil];
[doneButton setTitleTextAttributes:attrDict forState:UIControlStateNormal];
UIBarButtonItem *flexWidth = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace
target:self action:nil];
[kbToolbar setItems:[NSArray arrayWithObjects:cancelButton,flexWidth, doneButton, nil]];
return kbToolbar;
}
hinzufügen mehr Einzelheiten. – Maddy
Ich sehe das gleiche. Meine Eingabezubehöransicht wird nicht angezeigt. –