Scrolling code in UICatalog

Discussion in 'iPhone/iPad Programming' started by iphonejudy, Dec 4, 2008.

  1. macrumors 6502

    iphonejudy

    Joined:
    Sep 12, 2008
    #1
    Hi,

    The below code is used in UICatalog example for scrolling.


    in TextFieldController.m

    // Animate the entire view up or down, to prevent the keyboard from covering the author field.
    - (void)setViewMovedUp:(BOOL)movedUp
    {
    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDuration:0.3];
    // Make changes to the view's frame inside the animation block. They will be animated instead
    // of taking place immediately.
    CGRect rect = self.view.frame;
    if (movedUp)
    {
    // If moving up, not only decrease the origin but increase the height so the view
    // covers the entire screen behind the keyboard.
    rect.origin.y -= kOFFSET_FOR_KEYBOARD;
    rect.size.height += kOFFSET_FOR_KEYBOARD;
    }
    else
    {
    // If moving down, not only increase the origin but decrease the height.
    rect.origin.y += kOFFSET_FOR_KEYBOARD;
    rect.size.height -= kOFFSET_FOR_KEYBOARD;
    }
    self.view.frame = rect;

    [UIView commitAnimations];
    }

    I used that code,But it is not working.

    Whats mistake i done.

    Can anybody please tell me?

    Regards
    judy
     

Share This Page