을 제어하는 방법 UISearchDisplayController 의 자신의 테이블 보?
문제
내 응용 프로그램을 때,나는 필터 내 테이블을 때,나는 탭 셀,프레임 높이가 증가하기 위해서 표시 UIProgressView
는 다운로드 진행 상황을 표시합니다.
그러나 때,필터를 가져온 결과를 컨트롤러와 함께 데이터 UISearchDisplayController
, 세포에서는 이러한 필터링된 테이블보기하지 않는 행동에 동일한 방법입니다.
대신,세포의 크기를 조절하지 않는 다는 것,보이지 않는 진행 뷰가 트리거되지 않습니 다운로드,및 응용 프로그램 이후에 충돌.
어떻게 이득 제어 테이블을 통해 볼 때 표시되는 필터링하는 결과 UISearchDisplayController
?
편집
여기에 나 -tableView:didSelectRowAtIndexPath:
방법입니다.그것은 약간의 긴하지만,요점은 그것이 잘 작동하지 않을 때입니다.
나는 생각한 적응해야하는 이를 어떻게든,그래서 작업할 수 있습니다 어떤 테이블 보기/가 결과를 컨트롤러 검색 결과 컨트롤러가지입니다.
- (void) tableView:(UITableView *)tv didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
[tv deselectRowAtIndexPath:indexPath animated:YES];
if ([self.searchBar isFirstResponder])
[self.searchBar resignFirstResponder];
MyObject *_myObject = (MyObject *)[self.fetchedResultsController objectAtIndexPath:indexPath];
if (self.isSimulatingFileHierarchy)
{
if ([_myObject isFolder])
{
ObjectsViewController *_objectsViewController = [[ObjectsViewController alloc] initWithNibName:@"ObjectsViewController" bundle:nil];
_objectsViewController.managedObjectContext = self.managedObjectContext;
_objectsViewController.nodeID = self.nodeID;
_objectsViewController.nodeName = self.nodeName;
_objectsViewController.parentObjectKey = [_myObject cleanedKey];
if (self.parentObjectKey)
_objectsViewController.title = [[_myObject cleanedKey] stringByTrimmingPrefix:[self.parentObjectKey stringByAppendingString:@"/"]];
else
_objectsViewController.title = [_myObject cleanedKey];
[self.navigationController pushViewController:_objectsViewController animated:YES];
UIBarButtonItem *_backButton = [[UIBarButtonItem alloc] initWithTitle:self.title style:UIBarButtonItemStyleDone target:nil action:nil];
self.navigationItem.backBarButtonItem = _backButton;
[_backButton release];
[_objectsViewController release];
}
else {
//
// If we don't have data cached for this object, we add a request for the object's bytes to the objectRequestQueue
//
// 1. We add a progress indicator to the object's cell (we have an indexPath)
// 2. We store the data to the Documents folder
//
// Once we have the data, we push a ViewerViewController subclass that is specific to the object content type
//
if ((!_myObject.isDownloading) && ([_myObject.localPath length] == 0))
{
if ([AwsObject objectContentSupportedForType:[_myObject.contentType intValue]])
{
//
// Start request and redraw row with UIProgressView
//
[self triggerObjectRequestAdditionForObject:_myObject atIndexPath:indexPath];
}
else {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"ObjectsViewObjectRequestUnsupportedTypeAlertViewTitle", @"") message:NSLocalizedString(@"ObjectsViewObjectRequestUnsupportedTypeAlertViewMessage", @"") delegate:self cancelButtonTitle:nil otherButtonTitles:NSLocalizedString(@"ObjectsViewObjectRequestUnsupportedTypeAlertViewContinue", @""), nil];
[alert show];
[alert release];
}
}
else if ((_myObject.isDownloading) && ([_myObject.localPath length] == 0))
{
//
// Cancel request and redraw row without progress view
//
[self triggerObjectRequestRemovalForObject:_myObject atIndexPath:indexPath];
}
else if ((!_myObject.isDownloading) && ([_myObject.localPath length] != 0))
{
//
// Launch viewer for supported MIME type
//
switch ([_myObject.contentType intValue]) {
case kObjectContentTypeApplicationMsword: {
[self pushWebViewerViewController:_myObject withTextEncoding:@"UTF-8"];
break;
}
// handle other MIME types here...
}
}
else {
if ([_myObject isFolder]) { }
else {
if ((!_myObject.isDownloading) && ([_myObject.localPath length] == 0))
[self triggerObjectRequestAdditionForObject:_myObject atIndexPath:indexPath];
else if ((_myObject.isDownloading) && ([_myObject.localPath length] == 0))
[self triggerObjectRequestRemovalForObject:_myObject atIndexPath:indexPath];
else if ((!_myObject.isDownloading) && ([_myObject.localPath length] != 0)) {
switch ([_myObject.contentType intValue]) {
case kObjectContentTypeApplicationMsword: {
[self pushWebViewerViewController:_myObject withTextEncoding:@"UTF-8"];
break;
}
// handle other MIME types here...
}
}
}
}
}
}
}
해결책
에는 테이블 보기 위임하는 방법을 검색할 수 있습니다 만약 당신이 작업 UISearchDisplayController 의 테이블보기를 사용하여 다음과 같은 체크인:
if (tableView == self.searchDisplayController.searchResultsTableView) {
// behavior specific to search display controller table view
}
else {
// behavior specific to the original, unfiltered table view
}
다른 팁
일반적으로,당신은 것이 확인하는 경우에는 테이블 보기되고 전달 tableView:didSelectRowAtIndexPath:
과 동일한 검색을 디스플레이 컨트롤러의"searchResultsTableView"및 프로그램으로 대체 행동을 위해 하는 경우입니다.
그것은 소리처럼 당신의 문제는 더 복잡합니다.게시할 수 있습니 코드 tableView:didSelectRowAtIndexPath:
?