2015-05-15 57 views
0

我正在使用swreveal來做滑動菜單,我想在其中添加搜索欄。但是,搜索欄已被父視圖覆蓋。無法編輯`UITableViewController`中的搜索欄寬度和x座標

enter image description here

slide_areaWidth = self.revealViewController().rightViewRevealWidth 
    searchBar = UISearchBar(frame: CGRectMake(300, 0, 60, 64)) 
    var searchDisplayController: UISearchDisplayController = UISearchDisplayController() 
    searchDisplayController = UISearchDisplayController(searchBar: searchBar, contentsController: self) 
    //searchDisplayController.delegate = self 
    searchDisplayController.searchResultsDataSource = self 
    self.tableView.tableHeaderView = searchBar 

    self.tableView.tableHeaderView!.frame = CGRectMake(300, 0, 60, 64); 
+0

在這裏添加搜索框使用**窗口位置** + x,否則使用'SWLRevel'的委託方法** - (void)revealController:(SWRevealViewController *)revealController didMoveToPosition :(FrontViewPosition)position ** –

+0

對不起,我沒有依據窗口位置+ x。你的意思是UIScreen?非常感謝您 –

+0

我發現編輯'self.revealViewController()。rightViewRevealOverdraw'的解決方案爲0。非常感謝您的幫助 –

回答

0

沒有可以解決這個問題,它可以在SWRevealViewController.m被發現

斯威夫特一個簡單的方法: self.revealViewController().rightViewRevealOverdraw = 0