Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/25.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/97.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ionic-framework/2.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
Objective c 编辑文本视图时如何禁用滚动? 我有一个UISCLVIEW视图,中间有一个UITExtVIEW,底部有一个按钮。 当我按下按钮时,我想编辑UItextView,然后滚动到顶部。问题是,当我按下按钮时,UITextView在代码中被编辑,然后它会自动滚动到此UITextView的行,并忽略我滚动到顶部的代码行 - (IBAction)SubmitForm:(id)sender { if ([Titre.text length] == 0 || [TypeIntervention.text length] == 0 || [Client.text length] == 0) { ErrorMsg.text = @"test"; [self.Scroll setContentOffset:CGPointMake(self.Scroll.contentOffset.x, 0)animated:YES]; } else { DoneMsg.text = @"test"; } }_Objective C_Ios_Xcode_Uiscrollview_Uitextview - Fatal编程技术网

Objective c 编辑文本视图时如何禁用滚动? 我有一个UISCLVIEW视图,中间有一个UITExtVIEW,底部有一个按钮。 当我按下按钮时,我想编辑UItextView,然后滚动到顶部。问题是,当我按下按钮时,UITextView在代码中被编辑,然后它会自动滚动到此UITextView的行,并忽略我滚动到顶部的代码行 - (IBAction)SubmitForm:(id)sender { if ([Titre.text length] == 0 || [TypeIntervention.text length] == 0 || [Client.text length] == 0) { ErrorMsg.text = @"test"; [self.Scroll setContentOffset:CGPointMake(self.Scroll.contentOffset.x, 0)animated:YES]; } else { DoneMsg.text = @"test"; } }

Objective c 编辑文本视图时如何禁用滚动? 我有一个UISCLVIEW视图,中间有一个UITExtVIEW,底部有一个按钮。 当我按下按钮时,我想编辑UItextView,然后滚动到顶部。问题是,当我按下按钮时,UITextView在代码中被编辑,然后它会自动滚动到此UITextView的行,并忽略我滚动到顶部的代码行 - (IBAction)SubmitForm:(id)sender { if ([Titre.text length] == 0 || [TypeIntervention.text length] == 0 || [Client.text length] == 0) { ErrorMsg.text = @"test"; [self.Scroll setContentOffset:CGPointMake(self.Scroll.contentOffset.x, 0)animated:YES]; } else { DoneMsg.text = @"test"; } },objective-c,ios,xcode,uiscrollview,uitextview,Objective C,Ios,Xcode,Uiscrollview,Uitextview,实现UITextView委托并使用UIScrollView的scrollEnabled属性 - (BOOL)textViewShouldBeginEditing:(UITextView *)textView{ self.Scroll.scrollEnabled = NO; return YES; } - (void)textViewDidBeginEditing:(UITextView *)textView { self.Scroll.scrollEnabled =

实现UITextView委托并使用UIScrollView的scrollEnabled属性

- (BOOL)textViewShouldBeginEditing:(UITextView *)textView{

    self.Scroll.scrollEnabled = NO;

    return YES;
}
- (void)textViewDidBeginEditing:(UITextView *)textView {

    self.Scroll.scrollEnabled = NO;

}

- (BOOL)textViewShouldEndEditing:(UITextView *)textView{

    self.Scroll.scrollEnabled = YES;
    return YES;
}
- (void)textViewDidEndEditing:(UITextView *)textView{

    self.Scroll.scrollEnabled = YES;;
}

我确实将UITextView委托给了我的ViewController.m,然后在最后添加了这段代码,但当我按下按钮时,UITextView会发生变化,UIScrollView会滚动到UITextView。我在这里找到了答案