The UISearchBar
似乎有inputAccessoryView
as a readOnly
财产。如何使用我自己的 customToolbar 设置它?
Edit:正如下面的评论中提到的,这不再是 iOS 6 后的问题。请参阅UISearchBar
文档here https://developer.apple.com/library/ios/documentation/UIKit/Reference/UISearchBar_Class/#//apple_ref/occ/instp/UISearchBar/inputAccessoryView.
The UIResponder
(其中UISearchBar
是的间接子类)类文档 http://developer.apple.com/library/ios/#documentation/uikit/reference/UIResponder_Class/Reference/Reference.html#//apple_ref/occ/cl/UIResponder详细说明了实现此目的的方法:
想要将自定义控件附加到
系统提供的输入视图(例如键盘)或自定义输入
view(您在 inputView 属性中提供的一个)应该重新声明这一点
属性为可读写并使用它来管理其自定义配件
看法。当接收者随后成为第一响应者时,
响应者基础设施将视图附加到适当的输入
在显示之前查看。
e.x.
@interface CustomSearchBar : UISearchBar
@property (readwrite, retain) UIView *inputAccessoryView;
@end
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)