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
Post a Comment