I have a UIToolbar whose width is not changing, when the app is in multitasking mode.
self.toolBarKeyboard = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 44)];
self.textfieldUserID.inputAccessoryView = self.toolBarKeyboard;
I tried updating the toolBarKeyboard's frame in viewDidLayoutSubviews
method by calling self.toolBarKeyboard = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 44)];
inside this method.
I tried adding constraints to the toolBar as below and that didn't help either.
self.toolBarKeyboard.translatesAutoresizingMaskIntoConstraints = NO;
[self.toolBarKeyboard addConstraint:[NSLayoutConstraint constraintWithItem:self.toolBarKeyboard attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:self.toolBarKeyboard.superview attribute:NSLayoutAttributeWidth multiplier:1 constant:0.0]];
self.toolBarKeyboard = [[UIToolbar alloc] init];
self.textfieldUserID.inputAccessoryView = self.toolBarKeyboard;
[self.toolBarKeyboard addConstraint:[NSLayoutConstraint constraintWithItem:self.toolBarKeyboard attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:nil multiplier:1 constant:44.0]];
When I change my view from horizontal compact class (multitasking mode) to a horizontal regular class, the tool bar doesn't resize. Any idea what I'm missing here?