TableView中的自定义警报显示通过?

时间:2012-11-23 10:21:57

标签: iphone xcode ios6 tableview uialertview

不确定如何启动此主题,因为我之前没有看到过这种情况?

加载...

enter image description here

搜索之前......

enter image description here

搜索后...

enter image description here

我有一个带有自定义加载警报的TableView,当我添加一个SearchBar时,自定义加载Alert会显示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;
}

2 个答案:

答案 0 :(得分:0)

为此您可以添加以下代码

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

这将在表格视图上方设置活动指示器位置。 祝你好运...... :)

答案 1 :(得分: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行和第37行38:

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