当前位置: 动力学知识库 > 问答 > 编程问答 >

ios - view stop scrolling after resizing

问题描述:

i am having a little problem. I have a view that is 320 x 900 with a UIScrollView and constraints and everything works fine. i have a NSNotification for keyboard did show and that works fine as well (tested with NSLog). when keyboard shows i am changing my frame to 320 x 1200 and then the view stop scrolling. The app doesn't crash since i'm able to go back. i have search everywhere and i can't get to find the right answer.

here is a piece of my code

- (void)viewDidLoad {

[super viewDidLoad];

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWasShown:) name:UIKeyboardDidShowNotification object:nil];

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillHide:) name:UIKeyboardWillHideNotification object:nil];

}

-(void)keyboardWasShown:(NSNotification *)notification{

NSLog(@"Keyboard is shown.");

self.view.frame = CGRectMake(0, 0, 320, 1200);

self.scrollView.frame = CGRectMake(0, 0, 320, 1200);

}

Any help would be Appreciate

Thank you

分享给朋友:
您可能感兴趣的文章:
随机阅读: