2009-10-20 89 views

回答

3

iPhone应用程序编程指南中的Managing the Keyboard部分讨论了如何接收键盘显示/未显示通知以及如何让内容可见(包括示例代码)。

0

试试这个代码:

#define kTextFieldMovementDistance  150.0 //You can set this according to your need 
#define kMinimumMovementDuration  0.3f 

- (void) slidingViewUpward: (BOOL) isSlidingUp 
{ 
    CGFloat movementDistance = kTextFieldMovementDistance; 

    const float movementDuration = kMinimumMovementDuration; 

    int movement = (isSlidingUp ? -movementDistance : movementDistance); 

    [UIView beginAnimations: @"animation" context: nil]; 
    [UIView setAnimationBeginsFromCurrentState: YES]; 
    [UIView setAnimationDuration: movementDuration]; 
    self.view.frame = CGRectOffset(self.view.frame, 0, movement); 

    [UIView commitAnimations]; 
} 

当你想在视图中向上的方向滑动,或者在键盘成为第一个响应者,在通过布尔值如YES,否则为NO

相关问题