2009-08-21 63 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