在iOS16系统下,选中textview文本后,会出现搜索网页的按钮。
只需要设置如下代码,就可以屏蔽该功能
OC
- (void)buildMenuWithBuilder:(id<UIMenuBuilder>)builder API_AVAILABLE(ios(13.0)) {
if (@available(iOS 16.0, *)) {
[builder removeMenuForIdentifier:UIMenuLookup];
}
[super buildMenuWithBuilder:builder];
}
swift
@available(iOS 13.0, *)
func buildMenu(with builder: UIMenuBuilder) {
if #available(iOS 16.0, *) {
builder.remove(menu: .lookup)
}
super.buildMenu(with: builder)
}
网友评论