Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UISplitViewController detail-only inputAccessoryView

I am trying to imitate Apple's iMessage application in terms of the message input toolbar. Apple has a UIToolbar which is the input accessory view of a UITextView it contains, and also the inputAccessoryView of the actual view. That way, the toolbar is always present, and when the keyboard appears, it slides with the keyboard.

On the iPad, they seem to have a UISplitViewController, and the toolbar is part of the detail view controller. Now, when I have the same set up, my detail view's input accessory toolbar stretches to the whole width, so just like the keyboard, it also overlaps the master view controller. Apple, on the other hand, somehow managed to restrict the input accessory to the constraints of the detail view.

How can I do that?

like image 253
arik Avatar asked Jul 11 '14 12:07

arik


1 Answers

That's not possible to have inputAccessoryView only for one viewController in UISplitViewController. My way to do it is to have inputAccessoryView as container and have subview in it with 320px offset.


 - (void)setFrame:(CGRect)frame
{
    if (RUNNING_ON_IPAD)
    {
        CGFloat superviewWidth = self.superview.bounds.size.width;

        CGFloat offset = 321.f;
        frame.origin.x = offset;
        frame.size.width = superviewWidth - offset;
    }

    [super setFrame:frame];

}
like image 56
Nikita Ivaniushchenko Avatar answered Sep 22 '22 21:09

Nikita Ivaniushchenko