Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Add scroll view,display your controls on it, add the Keyboard notification,adjust the scroll contents.</p> <p>A good documents is available <a href="http://mobile.tutsplus.com/tutorials/iphone/ios-sdk-keeping-content-from-underneath-the-keyboard/" rel="nofollow">here</a></p> <pre><code> - (void)viewDidLoad { @try { [super viewDidLoad]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWasShown:) name:UIKeyboardDidShowNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillHide:) name:UIKeyboardWillHideNotification object:nil]; } @catch (NSException *exception) { NSLog(@"%s\n exception: Name- %@ Reason-&gt;%@", __PRETTY_FUNCTION__,[exception name],[exception reason]); } } - (void)keyboardWasShown:(NSNotification *)notification { @try { // Step 1: Get the size of the keyboard. CGSize keyboardSizePotriat = [[[notification userInfo] objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue].size; CGSize keyboardSize = {keyboardSizePotriat.height,keyboardSizePotriat.width}; // Step 2: Adjust the bottom content inset of your scroll view by the keyboard height. UIEdgeInsets contentInsets = UIEdgeInsetsMake(0.0, 0.0, keyboardSize.height, 0.0); self.theScrollView.contentInset = contentInsets; self.theScrollView.scrollIndicatorInsets = contentInsets; CGPoint scrollPoint = CGPointMake(0.0, self.txtMRN.frame.origin.y - (keyboardSize.height - 45)); [self.theScrollView setContentOffset:scrollPoint animated:YES]; } @catch (NSException *exception) { NSLog(@"%s\n exception: Name- %@ Reason-&gt;%@", __PRETTY_FUNCTION__,[exception name],[exception reason]); } } - (void) keyboardWillHide:(NSNotification *)notification { @try { UIEdgeInsets contentInsets = UIEdgeInsetsZero; self.theScrollView.contentInset = contentInsets; self.theScrollView.scrollIndicatorInsets = contentInsets; } @catch (NSException *exception) { NSLog(@"%s\n exception: Name- %@ Reason-&gt;%@", __PRETTY_FUNCTION__,[exception name],[exception reason]); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload