Remove annotations containing a title equal/not equal to a String?
NickName:Cory Billeaud Ask DateTime:2016-11-15T00:33:42

Remove annotations containing a title equal/not equal to a String?

I have looked for a couple of days on trying to remove annotations that a title equal or not equal to a string that is selected from a uicollection View cell didSelect from another view controller. I get the string passed to my view controller that contains my mapview. I use a custom annotation that is the model for how the annotations are displayed.

How do I select and remove the custom annotations by their title. I already have an array of dictionaries that contains the data the annotations will use once the other annotations are removed. I know how to remove ALL the annotations, but not how to just remove the ones that have titles that are equal/not equal to the search string.

Why is nothing on the web or current for swift 3 for such a function?

I have come up with this, but only removed annotations and does display the "filteredAnnotations"

 var filteredAnnotations = self.mapview.annotations.filter {($0.title != nil) && isEqual(searchString) }

 print(filteredAnnotations)

 self.mapview.removeAnnotations(self.mapview.annotations)
 self.mapview.addAnnotations(filteredAnnotations)

using the print statement only returns an empty array of "[]"

Copyright Notice:Content Author:「Cory Billeaud」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/40593539/remove-annotations-containing-a-title-equal-not-equal-to-a-string

More about “Remove annotations containing a title equal/not equal to a String?” related questions

Remove annotations containing a title equal/not equal to a String?

I have looked for a couple of days on trying to remove annotations that a title equal or not equal to a string that is selected from a uicollection View cell didSelect from another view controller....

Show Detail

Remove annotations containing a title equal to a tableView textLabel

UPDATE I'm still brand new to Swift so please bear with me. I have two ViewControllers. One contains a mapView and when I add an annotation, the annotation.title / annotation.subtitle is automatic...

Show Detail

Remove Specific Array Element, Equal to String - Swift

Is there no easy way to remove a specific element from an array, if it is equal to a given string? The workarounds are to find the index of the element of the array you wish to remove, and then

Show Detail

Remove equal item from java list

I have a list of items, where each item is a simple class containing 2 public strings. I have an equals method that simply makes use of the equalsIgnoreCase methot of String for both strings. public

Show Detail

Matlab - string containing a number and equal sign

I have a data file that contains parameter names and values with an equal sign in between them. It's like this: A = 1234 B = 1353.335 C = D = 1 There is always one space before and after the eq...

Show Detail

Setting String arrays equal to each other

Is it possible to set two String[] equal to each other while one has been returned (method has been returned containing a String[])? Example: Returned array>>>>>>>>>>>Array I want set equal to the

Show Detail

SQL select statement to return lines containing string not just equal to string

I need SQL statement to return all the lines containing the text entered into a search box and not just the ones that are equal to the text entered. SELECT * from table WHERE name='" + this.Search...

Show Detail

php is not equal to and is not equal,equal to

I keep seeing variations of this: Not equal != Not equal, equal !== Which one is the standard or do they have different meanings? I am guessing the latter also checks the value and the name if...

Show Detail

responsive and equal height for a set of boxes

There are three boxes in a line, each one containing an image and a title. I can use height property to make their height equal. But in a Responsive view, when the boxes shrink, because of the fixed

Show Detail

Android String Not Equal

I am brand new to Java and Android so I am sure this will be an easy question/answer. I know that to find out if a string is equal to another string you use the equal function. In my situation, I am

Show Detail