UISearchBar inputAccessoryView [英] UISearchBar inputAccessoryView

查看:73
本文介绍了UISearchBar inputAccessoryView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

UISearchBar 似乎有 inputAccessoryView readOnly 属性。如何使用自己的customToolbar设置它?

The UISearchBar seems to have the inputAccessoryView as a readOnly property. How do I set it with my own customToolbar ?

推荐答案

编辑下面,这不再是iOS 6后的问题。请参阅 UISearchBar 文档此处

As is mentioned in the comments below, this is no longer an issue post iOS 6. See the UISearchBar documentation here.

UIResponder (其中 UISearchBar 是一个间接子类)类文档详细说明完成此操作的方法:

The UIResponder (of which UISearchBar is an indirect subclass of) class documentation details a way to accomplish this:


要将自定义控件附加到
系统提供的输入视图例如键盘)或自定义输入
视图(您在inputView属性中提供的一个)应将此
属性重新声明为readwrite,并使用它来管理其自定义附件
视图。当接收者随后成为第一响应者时,
响应者基础结构在显示它之前将视图附加到适当的输入
视图。

Subclasses that want to attach custom controls to either a system-supplied input view (such as the keyboard) or a custom input view (one you provide in the inputView property) should redeclare this property as readwrite and use it to manage their custom accessory view. When the receiver subsequently becomes the first responder, the responder infrastructure attaches the view to the appropriate input view before displaying it.

ex

@interface CustomSearchBar : UISearchBar
@property (readwrite, retain) UIView *inputAccessoryView;
@end

这篇关于UISearchBar inputAccessoryView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆