嗨有人可以帮我吗
我想在 ios 9 中隐藏键盘上的附件栏
它的工作发现直到 ios 8 但在 ios 9 我无法隐藏附件栏我厌倦了这段代码但它不工作
for (UIView *possibleFormView in [keyboardWindow subviews]) {
if([[possibleFormView description] hasPrefix:@"<UIInputSetContainerView"])
{
for(UIView *view1 in possibleFormView.subviews)
{
if([[view1 description] hasPrefix:@"<UIInputSetHostView"])
{
for (UIView *peripheralView_sub in view1.subviews) {
//Hides the backdrop (iOS 8)
if ([[peripheralView_sub description] hasPrefix:@"<UIKBInputBackdropView"] ) {
[[peripheralView_sub layer] setOpacity:0.0];
}
if([[peripheralView_sub description] hasPrefix:@"<<_UIRemoteKeyboardPlaceholderView"])
{
CGRect newRect= peripheralView_sub.frame;
newRect.origin.y=44;
newRect.size.height=398-44;
peripheralView_sub.frame=newRect;
peripheralView_sub.clipsToBounds=false;
for(UIView *remoteKeyboardView in peripheralView_sub.subviews)
{
NSLog(@"Remote Key View %@",remoteKeyboardView);
}
}
if ([[peripheralView_sub description] hasPrefix:@"<UIWebFormAccessory"]) {
for (UIView *UIInputViewContent_sub in peripheralView_sub.subviews) {
CGRect frame1 = UIInputViewContent_sub.frame;
frame1.size.height = 0;
peripheralView_sub.frame = frame1;
UIInputViewContent_sub.frame = frame1;
[[peripheralView_sub layer] setOpacity:0.0];
}
CGRect viewBounds = peripheralView_sub.frame;
viewBounds.size.height = 0;
peripheralView_sub.frame = viewBounds;
[peripheralView_sub removeFromSuperview];
}
}
}
}
}
}
您可以通过从活动文本字段中删除所有辅助栏按钮来隐藏它。
UITextField *textField = ...
if ([textField respondsToSelector:@selector(inputAssistantItem)]) {
UITextInputAssistantItem *inputAssistantItem = [textField inputAssistantItem];
inputAssistantItem.leadingBarButtonGroups = @[];
inputAssistantItem.trailingBarButtonGroups = @[];
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)