Reputation: 29
I have a UIView with a UINavigation controller and several other Imageviews and a text filed inside it. On the Nagivation bar there is a UIBarbutton item which pushes another ViewController.
When the text field in the Navigation Viewcontroller is tapped it brings up the keyboard causing the Navigation bar with UIBarbutton item to slide out of the screen and thus making the UIBarbutton item unaccessible until the done button is pressed on the keyboard.
A notification is sent to this method whenever the keyboard is invoked.
- (void)displayKeyboard {
self.view.transform = CGAffineTransformTranslate(self.view.transform, 0.0, -100.0);
}
I tried using the IB to add a scrollview onto the view but this causes the entire view to be blocked.
Is there any other way i can enable the scroll view whenever the keyboard appears so i can scoll the entire screen ?
Upvotes: 0
Views: 300
Reputation: 5409
maybe you could try setting the frame of the current view.. for example:
CGRect r = self.view.frame;
self.view.frame = CGRectMake(r.origin.x, r.origin.y, r.size.width, r.size.height-100);
and when the user done with the keyboard, add 100 to bring it back.... (instead of 100, you should get the value from the notification object that contains the height, position of the keyboard)...
Upvotes: 1