2012-11-23 66 views
0

不知道如何開始這個線程,因爲我以前沒有見過這種情況?在TableView中的自定義警報顯示通過?

載入中...

enter image description here

搜索之前...

enter image description here

搜索後...

enter image description here

我有一個TableV使用自定義加載警報時,當我添加一個SearchBar自定義加載警報顯示來自TableView的行,有沒有人看過這之前,任何想法如何解決?

謝謝你們。

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 
{ 
if (tableView == self.searchDisplayController.searchResultsTableView) 

{ 
    return [self.searchResults count]; 
} 
else 
{ 
    return [self.itemsToDisplay count]; } 
} 

- (void)filterContentForSearchText:(NSString*)searchText scope:(NSString*)scope { 

[self.searchResults removeAllObjects]; 

for (MWFeedItem* item in itemsToDisplay) { 
    NSComparisonResult result = [[item.title stringByConvertingHTMLToPlainText] compare:searchText 
              options: (NSCaseInsensitiveSearch|NSDiacriticInsensitiveSearch) 
              range:NSMakeRange(0, [searchText length])]; 

    if (result == NSOrderedSame) { 

     [self.searchResults addObject:item]; 

    } 
}  
} 


-(BOOL)searchDisplayController:(UISearchDisplayController *)controller 
shouldReloadTableForSearchString:(NSString *)searchString 
{  
[self filterContentForSearchText:searchString 
          scope:[[self.searchDisplayController.searchBar scopeButtonTitles] 
            objectAtIndex:[self.searchDisplayController.searchBar 
               selectedScopeButtonIndex]]]; 

return YES; 
} 
+0

該表出現在您的圖像中的搜索結果??? – Omarj

+0

我已經添加了幾張圖片,這有幫助嗎? –

+0

所以它顯示沒有你做任何事情?在正常模式下? – Omarj

回答

0

爲此,您可以添加以下代碼

[self.view bringSubviewToFront:activityIndicatoriew]; 
[self.view sendSubviewToFront:tableView]; 

這將設置表格視圖上述活動的指標位置.. 祝你好運... :)

0

爲什麼你叫[super viewDidLoad]兩次?

> - (void)viewDidLoad 
> { 
> 
>  [super viewDidLoad]; 
> 
>  // show in the status bar that network activity is starting 
>  [UIApplication sharedApplication].networkActivityIndicatorVisible = YES; 
>  [[LoadingHUD loadingHUD] showInView:self.view]; 

參考您的file。刪除行37 & 38:

>  // Do any additional setup after loading the view, typically from a nib. 
>  [super viewDidLoad];