objective c - UISearchDisplayController inside UIPopOverController - searchResultsTableView not displaying properly -
so have tableview inside uipopovercontroller
, attached uisearchbar header of tableview , have uisearchdisplaycontroller
displaying correct results. however, can't results display within uipopovercontroller
window. it's displaying behind popover view detailview
covering half screen (splitviewcontroller
ipad). how bring results/tableview popover view? tried adding searchtableview
popover view, covers original tableview.
here code of setting up:
//initialize popover controller uiview *ccpopoverview = [[uiview alloc] init]; uiviewcontroller* popovertablecontent = [[uiviewcontroller alloc] init]; self.cctableview = [[uitableview alloc] initwithframe:cgrectmake(0, 44, 320, 400) style:uitableviewstyleplain]; self.cctableview.datasource = self; self.cctableview.delegate = self; self.searchbar = [[uisearchbar alloc] initwithframe:cgrectmake(0, 0, 320.0, 44.0)]; self.searchdisplaycontroller = [[uisearchdisplaycontroller alloc]initwithsearchbar:self.searchbar contentscontroller:self]; self.searchdisplaycontroller.searchresultsdatasource = self; self.searchdisplaycontroller.searchresultsdelegate = self; self.searchdisplaycontroller.delegate = self; searchbar.frame = cgrectmake(0, 0, 0, 38); self.cctableview.tableheaderview = searchbar; ccpopoverview.backgroundcolor = [uicolor blackcolor]; //here tried adding searchresultstableview subview. //[ccpopoverview addsubview:self.searchdisplaycontroller.searchresultstableview]; [ccpopoverview addsubview:self.cctableview]; popovertablecontent.view = ccpopoverview; self.popovertablecontroller.delegate = self; self.popovertablecontroller = [[uipopovercontroller alloc] initwithcontentviewcontroller:popovertablecontent]; [self.popovertablecontroller setpopovercontentsize:cgsizemake(320, 440) animated:no];
thanks!
i fixed issue instead of adding self
when initialized search bar, needed put in popovercontroller initialization.
Comments
Post a Comment