我一直在試圖找到解決方案几個小時,但唉,沒有骰子...我一直試圖實現一個UISearchBar純編程(沒有xib,沒有接口生成器)。UISearchBar沒有響應點擊時
這裏是我的.h頭:
@interface RLCASearchMasterViewController : UIViewController<UISearchBarDelegate>
@property (strong, nonatomic) RLCAGUIElements *gui;
@property (strong, nonatomic) RLCAUITableView *table;
@property (strong, nonatomic) UISearchBar *searchBar;
@end
和我的.m實現:
@synthesize searchBar;
- (void)loadView
{
[super loadView];
searchBar = [[UISearchBar alloc] initWithFrame:CGRectMake(self.view.frame.origin.x, self.view.frame.origin.y, self.view.frame.size.width, searchBar.frame.size.height)];
searchBar.delegate = self;
[self.view addSubview:searchBar];
}
我已經走了這一點,我不知道有多少次,不知道我做錯了什麼... UISearchBar被添加到視圖就好了,正確的大小和所有,但是當點擊/點擊時,鍵盤不會出現。 如果我喚起但是以下幾點:
[searchBar becomeFirstResponder];
鍵盤做演出,所以它可能不是代表團,但實際檢測是否已被點擊......我不希望它雖然對負載進行編輯,並且只能由請求...
請幫忙。謝謝! :)
此致, Piotr。
是它下面的任何其他意見?他們可能會阻止它的觸動。 – borrrden
我不認爲這是在任何的意見 - 我刪除了所有的[的UIColor clearColor]背景從所有檢查的意見,似乎沒有任何要覆蓋它... – Piotr