Enumerate through data structure objective-c -


I have the following data structure: I want to add a new object to a new array that will store my marker.
  ({title = "1"; location = "2";}, {title = "3"; location = "4";})  

How do I set up each marker so that the new array contains the property object marker of the first object, with the value of 1 title and marker. The value of 2?

You can create a new class for it, and you can add objects of that class array.

@interfaceMyClass: NSObject @property (strong, nonatomic) NSString * titles; @protecti (strong, non-constructive) NSString * location; @end

I have set the type to NSString so far, although you can change it to its preference.

You can create and add objects to objects as follows:

MyClass * newObject = [[MyClass alloc] init]; NewObject.title = @ "1"; NewObject.location = @ "2"; // Adding to the array [arr addObject: newObject];

For fitting, you can apply:

 for  (MyClass * obj in arr) {NSLog (@ "Title:% @, Place% @ ", Obj.title, obj.location); }  

Comments

Popular posts from this blog

python - Writing Greek in matplotlib labels, titles -

c# - LINQ to Entities does not recognize the method 'Int32 IndexOf(System.String, System.StringComparison)' method -

Pygame memory leak with transform.flip -