3
A
回答
6
我能想到的兩個選項:
通過繼承的UITextField創建自己的
- 組邊框風格UITextBorderStyleNone
- 設置leftView放大鏡圖像
- 將背景設置爲透明PNG與只顯示如果uiimages stretchableImageWithLeftCapWidth
- 利用輪邊界:這樣背景圖像將看起來不錯topCapHeight方法時的UISearchBar拉伸
勾搭,不建議
您可以訪問
for (UIView *aSubview in [searchbar subviews]) {
// this will remove the toolbar around the searchbar in iOS 4
if ([aSubview isKindOfClass:NSClassFromString(@"UISearchBarBackground")])
{
[aSubview removeFromSuperview];
}
// get a grip on the underlying textfield...
if ([aSubview isKindOfClass:NSClassFromString(@"UISearchBarTextField")])
{
UITextField *aTextfield = (UITextField *)aSubview;
// this won't do anything at it is already none, just experimenting
aTextfield.borderStyle = UITextBorderStyleNone;
// this will remove the whole border as it is a custom background
aTextfield.background = nil;
// this will remove the magnifying glass
aTextfield.leftView = nil;
// play around even more :)
}
}
您可以通過
隱藏搜索欄:在這樣一個UISearchBar子視圖- 隱藏屬性設置爲YES
- 設置可見區域以外的幀或中心屬性某處
- 組alpha屬性爲0.0
- 僅在需要時將所述搜索欄到視圖
相關問題
- 1. iBooks庫喜歡的效果
- 2. PDF閱讀器喜歡iBooks
- 3. MYSQL喜歡搜索2表
- 4. PHP PDO喜歡(搜索)
- 5. Google喜歡搜索框在Silverlight中
- 6. 在Facebook上顯示喜歡的喜歡數量喜歡按鈕
- 7. Mysql喜歡與多個列的搜索
- 8. 如何找到喜歡在露天Lucene搜索「的* .pdf」稱號
- 9. 如何檢索Facebook的喜歡數量喜歡按鈕代碼
- 10. iPhone:喜歡WP7的Metro UI
- 11. Vim CommandT喜歡搜索字符串
- 12. Mysql搜索引擎喜歡和匹配
- 13. 製作搜索引擎喜歡谷歌
- 14. 視覺工作室喜歡搜索
- 15. jQuery自動完成搜索喜歡Hotmail
- 16. MYSQL多樣喜歡搜索位置
- 17. SQL搜索喜歡或包含
- 18. xsl喜歡還是模糊搜索?
- 19. 劍道UI拖動喜歡的Windows桌面
- 20. iBooks風格的搜索
- 21. 矩形選擇喜歡在Windows桌面
- 22. 執行搜索喜歡谷歌搜索文本框
- 23. Disqus喜歡圖書館(UI)?
- 24. 如何實現谷歌喜歡玩搜索欄
- 25. 如何「喜歡」在Facebook上牆後
- 26. 數據庫設計:喜歡的桌子?
- 27. 谷歌喜歡在SQL Server中使用全文搜索的搜索查詢
- 28. 需要SQL查詢幫助:如何搜索和替換特定的文本喜歡x而不是喜歡xx
- 29. 如何按喜歡
- 30. 如何在UITableView中添加搜索欄喜歡iOS中的遊戲中心?
謝謝尼克。這對我幫助很大。 我不想直接隱藏搜索欄。相反,它應該位於表格視圖的頂部,並且只有在表格向下滾動時才顯示。 – 2011-05-07 05:54:30
我認爲你可以通過將搜索欄放在tableview scrollviews的內容區域,然後使用contentInset來初始化它來達到這種效果。 – 2011-05-07 08:46:34