Question

alt text http://img216.imageshack.us/img216/2288/problem11.png

As given in the picture, I have an search bar in my application.

Now I want to handle my custom action on Cancel Taped.

-> On Cancel Taped -> PopViewController -> On Cancel Taped -> Clear Search Text & Hide Search Bar Keyboard.

I don't know how to handle Cancel Tap?

Thanks in advance for helping me.

Was it helpful?

Solution

Ok ! I tried Something Different. I added a new button on Cancel Button.

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];

Now. See Following image. but it is with RoundedRect Type, Instead Use TypeCustom - so it will become invisible. alt text http://img269.imageshack.us/img269/4337/problem12e.png

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top