我正在为一个应用程序制作一个html编辑器组件(在iOS 5.0中使用带有contentEditable的UIWebView),并且陷入了如何处理UIWebView第一响应者状态
[webView isFirstResponder],[webView becomeFirstResponder]和[webView resignFirstResponder]似乎不起作用,我不知道如何让webView成为或通过代码辞职
如果有人知道如何解决这个问题,我将非常感激,提前谢谢!
我正在实现一个类似于Messages应用程序中发生的视图,因此有一个视图,UITextView附加到屏幕的底部,还有UITableView显示主要内容.当它被轻敲时,它会随着键盘向上滑动,当键盘被解除时,它会滑回到屏幕的底部.
我有这个部分并且它完美地工作 - 我只是订阅键盘通知 - 将隐藏和显示.
问题是我已经在UITableView上将键盘解除模式设置为交互式,并且我无法在平移时捕获对键盘的更改.
第二个问题是这个uitextview栏覆盖了uitableview的某些部分.如何解决这个问题?我仍然希望uitableview像在消息应用程序中一样"在"这个栏下面.
我在所有地方都使用AutoLayout.
任何帮助将不胜感激!
============
EDIT1:这是一些代码:
查看层次结构如下:
视图 - UITableView(这个将包含"消息") - UIView(这个将滑动)
UITableView对父视图的顶部,左侧,右侧和底部有约束,因此它填满整个屏幕.UIView对父视图的左侧,右侧和底部有约束,因此它粘在底部 - 我通过调整约束的常量来移动它.
在ViewWillAppear方法中:
NSNotificationCenter.DefaultCenter.AddObserver (UIKeyboard.DidShowNotification, OnKeyboardDidShowNotification);
NSNotificationCenter.DefaultCenter.AddObserver (UIKeyboard.WillChangeFrameNotification, OnKeyboardDidShowNotification);
NSNotificationCenter.DefaultCenter.AddObserver (UIKeyboard.WillHideNotification, OnKeyboardWillHideNotification);
Run Code Online (Sandbox Code Playgroud)
以下是方法:
void OnKeyboardDidShowNotification (NSNotification notification)
{
AdjustViewToKeyboard (Ui.KeyboardHeightFromNotification (notification), notification);
}
void OnKeyboardWillHideNotification (NSNotification notification)
{
AdjustViewToKeyboard (0.0f, notification);
}
void AdjustViewToKeyboard (float offset, NSNotification notification = null)
{
commentEditViewBottomConstraint.Constant = -offset;
if (notification != null) {
UIView.BeginAnimations (null, IntPtr.Zero);
UIView.SetAnimationDuration (Ui.KeyboardAnimationDurationFromNotification (notification));
UIView.SetAnimationCurve ((UIViewAnimationCurve)Ui.KeyboardAnimationCurveFromNotification (notification));
UIView.SetAnimationBeginsFromCurrentState (true);
} …Run Code Online (Sandbox Code Playgroud) autolayout ×1
html ×1
html-editor ×1
ios ×1
uikeyboard ×1
uitableview ×1
uiwebview ×1
xamarin ×1