I am using a real-time search against an external API (XML) based on what the user is entering in the search bar..
I am using a case-insensitive search. The thing was working fine, until I moved the code or rather added a thread. Suddenly the results that I get are a bit consistent. They are not incorrect, but they are sometimes lesser in number.
e.g. if a user enters "a", it will show around 7 results, say AAR, Aaron, Staar,Mtaar ...
Then if enters "aa" , it will show 1 result (AAR), then if he enters "aar", it will show 3 results AAR, Star, Mtaar
Again if backspace is pressed and if the current term in the search bar is aa, it will now show 3 results...
Another example, if I type "goog", it displays nothing in the table cell results (even though i see that it has parsed Google), while if i add an "l", i.e. if the term is now "googl", it now shows Google in the cell below.
I am updating my table view immediately after the parsing is complete.
So basically after I added thread, the search results have got a bit inconsistent. I am not sure why.
Note that in all cases the results shown are all correct, but just the no. of them is varying.
Could someone please help me with the issue.
Thanks a lot.
can you provide some sample code how you access your filtered table content array? You can NSLog() the result you get from the API and compare with the ones are displayed in your tableView.
Related
I want a button from the command line bar to be visible or invisible depending on whether a record has been selected in the lookup field from the main form or not.
If no record has been selected, then the button should be displayed. Otherwise not.
For this problem, I want to use the Power Fx in PowerApps, but I haven't found a command yet, which shows me the content or something like that of the lookup field. Other field data types like text have worked without problems.
With Javascript, I already managed it without problems, but I would like to do it also in PowerFx if that should work.
Screenshot: https://i.stack.imgur.com/uqDJ6.png
The records come from the Table Company, where the attribute is Companyname.
Commands where I think they might work:
If([Selected Record];true;false);If(IsBlank([Selected Record]);true;false);If(IsBlankOrError([Selected Record]);true;false);If(IsEmpty([Selected Record]);true;false)
I guess there are 2 scenarios:
The Lookup form control element is a Dropdown with a Selected output property. Then your approach would work like If(IsBlankOrError(DataCardValue1.Selected),true,false)
If your form control element is a ComboBox then you could use If(CountRows(DataCardValue1.SelectedItems)>0,true,false) or the above described IsBlankOrError.
Using Ionic3 to implement large list scrolling with virtualScroll.
I added a vertical slider (input range) linked to a function using Ionic3
this.content.scrollTo(0, yVal, 1000)
to scroll back and forth but if I scroll too far ahead in the list, I get the error
ERROR TypeError: Cannot read property 'scrollTop' of null
I played with the time parameter but nothing seems to make a difference.
My list has 10k items and if I scroll one step at a time (1%), everything is fine. But if I try to go all the way to 50% of the list, I get a blank output with the above error.
What am I doing wrong ???
Live sample and code can be found here:
https://ionic-list100k-segment-index.stackblitz.io
https://stackblitz.com/edit/ionic-list100k-segment-index
I am having some problem when it comes to display the steps from MKDirections route into a UILabel. I tried get each index from the steps array using the for in loop, it only show the Arrive at destination which means that all the instructions within the loop went by so fast, therefore i am seeing the last index in the array . Can someone help me please ...
it shows "Arrive at destination" because you are cycling the whole array and the label gets only the object at the end, you are basically overwriting it over and over until the for cycle arrives to its final element
You are seeing only the last value from the array in the UILabel, though it is actually displaying all the values very, very quickly. If you just want to see each of the values in the UILabel, you could either use UITimeInterval to change the value every few seconds, or add a UIButton that would handle updating of the text on the UILabel.
In my iphone app i have a search screen with UISearchDisplaycontroller uisng this against each scopeBar key words we can filter the search result, But using only this scopeBar buttons i couldnt reach my requirement.
See, I have a list of members, I need to search members based on state, country, city, name. and i should display these search types in a bar (say scopBar).
After selecting a scopeBar button(say Country)if we type 'India' in the search bar it should display all the members of that country. How can i achieve these kind of search ? I have tried many search tutorials, But those didnt help me. Please help me out.
Thanks in Advanced!
As per Apple's Sample code, we can use 2 arrays during search, 1 actual, and 2nd is filtered array as in example reference :
http://developer.apple.com/library/ios/#samplecode/TableSearch/Listings/MainViewController_m.html#//apple_ref/doc/uid/DTS40007848-MainViewController_m-DontLinkElementID_6
But in your case, we are requiring 3 arrays, third array will be local array (let's call scopedFilteredArray) during filteration.
Search all objects by scope bar : Using Predicate (contained by scopedFilteredArray, from actual array).
Search filtered objects from scopedFilteredArray and save them in filteredArray for display.
Have a modal window appear to select your extra filter parameters (put whatever control you want there), and create a global search nsmutabledictionary to store your parameters.
I put it to appear on the book (bookmarks) button (it passed apple checks), for easy access.
I'm using two UIPageControls in a view to reflect chapters and pages. So I have defined one UIPageControl named chapterCount and one named pageCount just to show where the user is. I handle the flipping of the pages with swipes rather than using the UIPageControls (so no methods defined for them).
I change their values as the user change pages with the following code:
chapterCount.numberOfPages = chapters;
chapterCount.currentPage = chapterNumber;
pageCount.numberOfPages = pages;
pageCount.currentPage = pageNumber;
[chapterCount updateCurrentPageDisplay];
[pageCount updateCurrentPageDisplay];
Where chapters, chapterNumber, pages and pageNumber all are integers.
The first time I flip through the pages it normally works fine, but when I go to a previous chapter or start a new chapter, the first (or last depending on direction) dot is not showed. Please see picture (upper half is missing a dot, lower one OK).
alt text http://img80.imageshack.us/img80/3339/pagecontrol.png
Its the same code updating the controls and sometime I get a dot, sometimes not. When I check the variables with NSLOG they are correct (eg the same for both pictures above).
I have checked Apple's documentation and tried their example but no luck.
Where should I start troubleshooting? I'm getting crazy!!
I finally found the problem :-)
An UIPageControl that is given a value 0 for number of pages will not show correctly the next time it is updated. I was reading chapter and page numbers from an array and in the beginning (let's say cover of the book) there are no pages and no chapters to show, so I happily set these to 0. Since I did not want to change the source data in my array I used MAX(pages , 1) for numberOfPages, so now it's working like clockwork.
Are you sure your chapterCount and pageCount views are not nil? You can have valid values all day, a message to nil does nothing and returns nil. Double check your view and controller wiring/unwiring when you change chapters.
EDIT:
confirm the size of the control is big enough to hold all your pages, and the view bounds is not clipped. For example, if you had 10 pages, and the "current" page was 10, but there were only 9 dots visible, it would appear as though nothing is highlighted because the white dot would be clipped from the visible area by being outside the viewable bounds. You can adjust the size dynamically using this:
- (CGSize)sizeForNumberOfPages:(NSInteger)pageCount