Hemant Sabale
Hemant Sabale

Reputation: 327

How to adjust frame of custom keyboard in iOS?

I am using custom keyboard LNNumberpad in my application. I am use it as an input view for UItextField . My application is for iPad . In my application I am adding two view side by side on screen. In one of the view I have UITextField .. for that UITextField I have sets inutView as LNNumberpad keyboard.

When I am selecting that UITextField LNNumberpad is appear. But what I want is I need to display that keyboard frame to UITextField superview frame.

As screen has two views side by side. I mean I want keyboard will appear only for second view on screen.

Please refer attached Image I want keyboard to appear just below enter quantity here textField

Upvotes: 0

Views: 325

Answers (2)

Johnny Rockex
Johnny Rockex

Reputation: 4196

If you don't want to make your own keyboard or use the built-in Apple default (is there a good UX reason for this?) then you could set the frame your LNNumberpadView directly, or if you prefer, put inside a holderView, like so:

UIView * holderView = [UIView new];
holderView.frame = CGRectMake(w-100, h-200, 100, 200);
[self.view addSubview:holderView];
[holderView addSubview:LNNumberpadView];

where w = screen width and h = screen height.

Then manipulate your holderView to animate or whatever.

Upvotes: 0

Evgeniy Kleban
Evgeniy Kleban

Reputation: 6975

If your LNNumberpad is subclass of UIView, as i suppose, you can change it frame using auto layout, setting fixed width and height and set other constraints just like any other view.

Apple reference to Auto Layout

Upvotes: 2

Related Questions