ios - How to create an NSMutableArray and assign a specific object to it? -


i getting obj c, , looking create array of mkannotations.

i have created mkannotation class called trucklocation contains name, description, latitude, , longitude.

here have far array:

nsmutablearray* trucksarray =[nsmutablearray arraywithobjects: @[<#objects, ...#>]  nil]; 

yore trying combine 2 different syntaxes similar different things. don't seem have instances of annotations.

create instances

trucklocation *a1 = ...; trucklocation *a2 = ...; 

then can add them

nsmutablearray *trucksarray = [nsmutablearray arraywithobjects:a1, a2, nil]; 

or

nsmutablearray *trucksarray = [@[a1, a2] mutablecopy] 

this shorter , more modern form need make mutable create immutable instance.


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -