6

मेरे आवेदन में, जब मैं अपनी तालिका को फ़िल्टर नहीं कर रहा हूं, जब मैं किसी सेल पर टैप करता हूं, तो UIProgressView प्रदर्शित करने के लिए इसकी फ्रेम ऊंचाई बढ़ जाती है जो डाउनलोड प्रगति दिखाती है।UISearchDisplayController के स्वयं के तालिका दृश्य को कैसे नियंत्रित करें?

हालांकि, जब मैं 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... 
         } 
        } 
       } 
      } 
     } 
    } 
} 

उत्तर

12

तालिका दृश्य प्रतिनिधि तरीकों में से किसी में, आप पता लगा सकते हैं यदि आप निम्न की जांच का उपयोग करके UISearchDisplayController की मेज दृश्य के साथ काम कर रहे हैं:

if (tableView == self.searchDisplayController.searchResultsTableView) { 
    // behavior specific to search display controller table view 
} 
else { 
    // behavior specific to the original, unfiltered table view 
} 
0

आमतौर पर, आप की जाँच करेगा तालिका दृश्य tableView:didSelectRowAtIndexPath: को पारित किया जा रहा है, तो आपके खोज प्रदर्शन नियंत्रक के उस मामले के लिए "searchResultsTableView" और कार्यक्रम वैकल्पिक व्यवहार के बराबर है।

ऐसा लगता है कि आपकी समस्या अधिक जटिल हो सकती है। क्या आप tableView:didSelectRowAtIndexPath: के लिए कोड पोस्ट कर सकते हैं?

संबंधित मुद्दे