Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7661463
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T13:36:07+00:00 2026-05-31T13:36:07+00:00

This is the code that I created using the tips and advice in the

  • 0

This is the code that I created using the tips and advice in the Iphone App Development For Dummies book. I am getting a warning that UIKeyboardBoundsUserInfoKey is deprecated. Is this method no longer valid? Did I screw up? My view isn’t scrolling up at all. This is my code:

#import "ReturnToMeTrainingViewController.h"
#import "ReturnToMeTrainingAppDelegate.h"
@implementation ReturnToMeTrainingViewController
@synthesize callNumber;
@synthesize textField; 
@synthesize label; 


/*
// The designated initializer. Override to perform setup that is required before the view is loaded.
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}
*/

/*
// Implement loadView to create a view hierarchy programmatically, without using a nib.
- (void)loadView {
}
*/



// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
    textField.clearButtonMode = UITextFieldViewModeWhileEditing;
    }


-(void)viewWillAppear:(BOOL)animated {
    [[NSNotificationCenter defaultCenter] addObserver:self
                                             selector:@selector(keyboardWillShow:) 
                                                 name:UIKeyboardWillShowNotification
                                               object:self.view.window];
    [super viewWillAppear:animated]; 
}

-(void)viewWillDisappear:(BOOL)animated {
    [[NSNotificationCenter defaultCenter] removeObserver:self
                                                    name:UIKeyboardWillShowNotification object:nil];
    [super viewWillDisappear:animated];
}

-(void)keyboardWillShow:(NSNotification *)notif {
    NSDictionary* info = [notif userInfo];
    NSValue* aValue = [info objectForKey:UIKeyboardBoundsUserInfoKey];
    CGSize keyboardSize = [aValue CGRectValue].size;
    float bottomPoint = (textField.frame.origin.y+textField.frame.size.height+10); 
    scrollAmount = keyboardSize.height - (self.view.frame.size.height-bottomPoint);
    if (scrollAmount > 0){
        moveViewUp = YES;
        [self scrollTheView:YES];
    }
    else {
        moveViewUp = NO;
    }
}

-(void)scrollTheView:(BOOL)movedUp{
    [UIView beginAnimations:nil context:nil];
    [UIView setAnimationDuration:0.3];
    CGRect rect = self.view.frame;
    if (movedUp){
        rect.origin.y -= scrollAmount;
    }
    else{
        rect.origin.y += scrollAmount;
    }
    self.view.frame = rect;
    [UIView commitAnimations];
}

-(void)touchesBegan:(NSSet *)touches withEvent:
(UIEvent*)event{
    if( textField.editing) {
        [textField resignFirstResponder];
        [self updateCallNumber];
        if (moveViewUp) [self scrollTheView:NO];
    }
    [super touchesBegan:touches withEvent:event];
}


/*
// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
*/

- (void)didReceiveMemoryWarning {
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];

    // Release any cached data, images, etc that aren't in use.
}

- (void)viewDidUnload {
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}


- (void)dealloc {
    [textField release];
    [label release];
    [callNumber release];
    [super dealloc];
}
-(BOOL)textFieldShouldReturn:(UITextField *)theTextField{
    [theTextField resignFirstResponder];
    if (moveViewUp) [self scrollTheView:NO];
    [self updateCallNumber];
    return YES;
}

-(void)updateCallNumber{
    self.callNumber = textField.text;
    label.text = self.callNumber;
}

@end
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T13:36:07+00:00Added an answer on May 31, 2026 at 1:36 pm

    Yes, it was deprecated in 3.2:

    See the UIWindow API Docs:

    UIWindow

    I use this code which works on old and new SDKs:

    // Get the size of the keyboard.
    #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 30200
        NSValue* aValue = [info objectForKey:UIKeyboardFrameBeginUserInfoKey];
    #else
        NSValue* aValue = [info objectForKey:UIKeyboardBoundsUserInfoKey];  
    #endif
    
    CGSize keyboardSize = [aValue CGRectValue].size;
    

    3.2 is pretty old. I’d get yourself a new book, or read some articles on the web that are up to date…. that example also doesn’t use the newer API for UIView animations using blocks, which are much more succinct than those………… unless of course you want to support 3.2.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've created this code branch so that if the permalink settings do no match
I have this code that fetches some text from a page using BeautifulSoup soup=
I have the this code that will create excel file and work sheet then
I have this code that performs an ajax call and loads the results into
So I have this code that takes care of command acknowledgment from remote computers,
I have this code that works in a unit test but doesn't work when
Challenge: I have this code that fails to compile. Can you figure out what's
I have this code that I want to make point-free; (\k t -> chr
I have this code that changes the opacity of the div on hover. $(#navigationcontainer).fadeTo(slow,0.6);
I've created a javascript tool using the beautytips plugin that uses beautytips to display

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.