2009-08-21 64 views

回答

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 - 因此它将变得不可见。 alt text http://img269.imageshack.us/img269/4337/problem12e.png