Discussion Forums  >  Plugins, Customizing, Source Code

Replies: 2    Views: 103

Sven
Lost but trying
Profile
Posts: 14
Reg: Aug 07, 2012
Hamburg, German...
1,790
01/10/13 04:50 PM (13 years ago)

RSS Plugin - adding a Searchbar

Hi there, i'm trying to add a searchbar to the plugin bt_screen_rssReader, because some of my Feeds are quite long and it would be nice to have an option to filter it. I added some declarations to the bt_screen-rssReader.h file: NSMutableArray *searchData; UISearchBar *searchBar; UISearchDisplayController *searchDisplayController; Then added some code in the .m: //end of viewdidload searchBar = [[UISearchBar alloc] initWithFrame:CGRectMake(0, 0, 320, 44)]; searchDisplayController = [[UISearchDisplayController alloc] initWithSearchBar:searchBar contentsController:self]; searchDisplayController.delegate = (id)self; searchDisplayController.searchResultsDataSource = self; [self.myTableView setTableHeaderView:searchBar]; The searchbar is displayed and seems to work (at least the keyboard is displayed when the searchbar is clicked) Could someone give me a hint on how to correctly use the: - (BOOL)searchDisplayController:(UISearchDisplayController *)controller shouldReloadTableForSearchString:(NSString *)searchString {} I looked at some Tutorials but i'm not really sure how to use it. Which variable is holding the data? Is it *rssItems? Is it *menuItems? How to search this array and display it in the resultwindow AND format the resultwindow like the original tableview. for(element in menuItems) NSRange range = [element rangeOfString:searchString options:NSCaseInsensitiveSearch]; if (range.length > 0) { [searchData addObject:element]; } } ?!? Something like that? :) any help would be appreciated. Thanks Sven
 
LeonG
Apple Fan
Profile
Posts: 694
Reg: Nov 08, 2011
Hamburg
17,740
like
01/11/13 07:17 AM (13 years ago)
Hey Sven, pretty sure Kittsy and PSMDanny can help here, besides David himself :-) Interesting for me too!
 
ATRAIN53
Code is Art
Profile
Posts: 1755
Reg: Nov 17, 2011
Chicago
26,450
like
01/11/13 08:17 AM (13 years ago)
great post, welcome to BT and nice work getting the searchbar in the screen. you've got some skills :) now to make it actually search.... this is really going to be a multi-part answer. You're really modifying that existing plug-in code and will need to use the app delegate to accomplish this. (this could make a good future webinar!!) You seem new and learning to reverse engineer BT can be difficult. Are you understanding how JSON works in BT? A lot of us study existing code to learn. Some of the recent webinars have touched on menu items. There is a BT Search plug-in that would be great code to study. The search method in there could be re-used in the rss screen. You might want to look at that closer if it's an option to purchase/load? That would be my approach if I was tryign to do this. How that plug-in works and what it can search is a bit of a mystery @ here IMO. It only searches BT menusitems now I believe. Maybe if you load it and use it on a menu you'll start to see how you can possibly re-use it....
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.