Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone popviewcontroller重置scrollview内容偏移量_Iphone_Objective C_Ios - Fatal编程技术网

Iphone popviewcontroller重置scrollview内容偏移量

Iphone popviewcontroller重置scrollview内容偏移量,iphone,objective-c,ios,Iphone,Objective C,Ios,我有一个滚动视图,里面有一个UITextfield。当键盘出现时,我使用setContentOffset:animated:滚动滚动视图。但是,当按下“后退”按钮至popViewControllerAnimated:,scrollview将向下滚动。我希望在弹出视图时滚动位置保持不变。你知道如何让它正常工作吗 谢谢 // Called when the UIKeyboardDidShowNotification is sent. - (void)keyboardWasShown:(NSNotif

我有一个滚动视图,里面有一个UITextfield。当键盘出现时,我使用setContentOffset:animated:滚动滚动视图。但是,当按下“后退”按钮至popViewControllerAnimated:,scrollview将向下滚动。我希望在弹出视图时滚动位置保持不变。你知道如何让它正常工作吗

谢谢

// Called when the UIKeyboardDidShowNotification is sent.
- (void)keyboardWasShown:(NSNotification*)aNotification
{

...

// If active text field is hidden by keyboard, scroll it so it's visible
CGRect aRect = CGRectMake(0, 0, 320, 460-44-215);
aRect.size.height -= kbSize.height;
if (!CGRectContainsPoint(aRect, activeField.frame.origin) ) {
    CGPoint scrollPoint = CGPointMake(0.0, activeField.frame.origin.y-80);
    [sv setContentOffset:scrollPoint animated:YES];
}
}

在我看来,你辞职的文本字段第一响应者状态太早。谢谢,我让它工作。把你的答案加上,我会记下来的。