1

替代文字 http://img216.imageshack.us/img216/2288/problem11.png

如图所示,我的应用程序中有一个搜索栏。

现在我想处理我在 Cancel Taped 上的自定义操作。

-> On Cancel Taped -> PopViewController -> On Cancel Taped -> 清除搜索文本并隐藏搜索栏键盘。

我不知道如何处理取消点击?

提前感谢您帮助我。

4

1 回答 1

2

好的 !我尝试了一些不同的东西。我在取消按钮上添加了一个新按钮。

UIButton *btn=[UIButton buttonWithType:UIButtonTypeCustom];
btn.backgroundColor=[UIColor clearColor];
[btn setFrame:CGRectMake(260, 5, 53, 32)];
[btn addTarget:self action:@selector(onCancelSearch:) forControlEvents:UIControlEventTouchUpInside];
[searchBar addSubview:btn];

现在。请参见下图。但它是 RoundedRect 类型,而不是使用 TypeCustom - 所以它会变得不可见。 替代文字 http://img269.imageshack.us/img269/4337/problem12e.png

于 2009-08-21T23:57:32.037 回答