Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 11-05-2011, 06:25 PM   #1 (permalink)
Registered Member
 
Join Date: Oct 2011
Location: Denmark
Posts: 24
thar is on a distinguished road
Default looking for a helpful person

Hello forum

My project is almost complete, missing only the last thing and now I'm stock.

I have the past several days trying to find a simple example on how to locate static pins on a map. But I can't find a good example or a good tutorial to do just that. I therefore seek a helpful person who would like to make a very simple example without unnecessary things that I can download. Example should be a map where there is located a minimum of two needles. So I can see what steps I should follow. My project will contain +100 needle when it is finished.

I can donate a little if it could be interesting?

Many thanks for your time.

Thar
thar is offline   Reply With Quote
Old 11-05-2011, 07:12 PM   #2 (permalink)
Registered Member
 
Join Date: May 2010
Posts: 577
Speed is on a distinguished road
Default

Here is what I use for displaying a simple, static annotation on a map.

Code:
float lon = -74.0063889;
float lat = 40.7141667;
        
CLLocationCoordinate2D coord;
coord.longitude = lon;
coord.latitude = lat;
        
AddressAnnotation *addAnnotation = [[AddressAnnotation alloc] initWithCoordinate:coord];
[mapView addAnnotation:addAnnotation];
[addAnnotation release];
Where "mapView" is an MKMapView object and AddressAnnotation is the custom class located here: http://minus.com/m9utDSzu8#1

Last edited by Speed; 11-05-2011 at 07:14 PM.
Speed is offline   Reply With Quote
Old 11-05-2011, 07:26 PM   #3 (permalink)
Registered Member
 
Join Date: Oct 2011
Location: Denmark
Posts: 24
thar is on a distinguished road
Default

Hey Speed

Many thanks for your time, I'm appreciated it. Is it possible to get an example with all the project files? This download only hold the .m and the .h file. Just so i can see it works in my simulator.

Thanks again

Thar

Last edited by thar; 11-05-2011 at 07:30 PM.
thar is offline   Reply With Quote
Old 11-05-2011, 07:37 PM   #4 (permalink)
Registered Member
 
Join Date: May 2010
Posts: 577
Speed is on a distinguished road
Default

It's a snippet from a project, so I'm afraid that I cannot send all of it. However, create a new view-based project, and add the code below into the -[viewDidLoad] method and you should see it working. Make sure you import the AddressAnnotation class as well.

Code:
MKMapView *mapT = [[MKMapView alloc] initWithFrame:CGRectMake(0, 0, 320, 460)];
[mapT setUserInteractionEnabled:NO];
[mapT setMapType:MKMapTypeStandard];
[mapT setZoomEnabled:YES];
[mapT setScrollEnabled:YES];
            
float lon = -74.0063889;
float lat = 40.7141667;
        
CLLocationCoordinate2D coord;
coord.longitude = lon;
coord.latitude = lat;
        
AddressAnnotation *addAnnotation = [[AddressAnnotation alloc] initWithCoordinate:coord];
[mapT addAnnotation:addAnnotation];
[addAnnotation release];

MKCoordinateRegion region = { {0.0, 0.0 }, { 0.0, 0.0 } }; 
region.center.latitude = lat;
region.center.longitude = lon;
            
float span = 0.2f;
                
region.span.longitudeDelta = span;
region.span.latitudeDelta = span;
[mapT setRegion:region animated:YES]; 
    
[[self view] addSubview:mapT];
[mapT release], mapT = nil;
Speed is offline   Reply With Quote
Old 11-05-2011, 07:49 PM   #5 (permalink)
Registered Member
 
Join Date: Oct 2011
Location: Denmark
Posts: 24
thar is on a distinguished road
Default

Hey Speed

Thanks for quick reply...

It sounds like you have mastered these things. I do not know if it's too much to ask, but will you make a quick new project and set up those thinks? So i can download the full functional example. It will means a lot to me.

I waited to the last with this map stuff, be course i think it will be easy. but no!

Thar
thar is offline   Reply With Quote
Old 11-05-2011, 07:52 PM   #6 (permalink)
Just helping out.
 
Domele's Avatar
 
Join Date: Feb 2011
Posts: 2,565
Domele is on a distinguished road
Default

Speed don't do it, you've done more than enough. This guy is just lazy now, you told him exactly what to do and even provided with him code and told him where to place it.

Thar, what part of Speed's instructions are you having trouble with?
__________________
If you are looking for a quality developer, I'm your man. Give me a PM if you are interested.

New app - See screenshots and details at www.globaclock.com.

If you want to thank me, click the link. Every click counts. If you want to do more, buy my app. A link is available on my website. Thanks.
Domele is offline   Reply With Quote
Old 11-05-2011, 07:54 PM   #7 (permalink)
Registered Member
 
Join Date: May 2010
Posts: 577
Speed is on a distinguished road
Default

Just paste the code in -[viewDidLoad:] after importing your files. Easy ;-)

For a fee, I would be able to implement the map in your current project, and/or send you the completed XCode project containing this code.

Last edited by Speed; 11-05-2011 at 07:57 PM.
Speed is offline   Reply With Quote
Old 11-06-2011, 01:31 AM   #8 (permalink)
Registered Member
 
Join Date: Oct 2011
Location: Denmark
Posts: 24
thar is on a distinguished road
Default

Quote:
Originally Posted by Speed View Post
Just paste the code in -[viewDidLoad:] after importing your files. Easy ;-)

For a fee, I would be able to implement the map in your current project, and/or send you the completed XCode project containing this code.
Hello Speed

Okay I will try, it just be course i'm not sure what you mean with import. Is it #import "blabla.h" or copy the files you uploaded in to the new project folder?

Its nice to know that you will do it for a fee, if I can't solved this problem myself.

I let you here anyway.

Thar
thar is offline   Reply With Quote
Old 11-06-2011, 12:13 PM   #9 (permalink)
Registered Member
 
Join Date: May 2010
Posts: 577
Speed is on a distinguished road
Default

Quote:
Originally Posted by thar View Post
Hello Speed

Okay I will try, it just be course i'm not sure what you mean with import. Is it #import "blabla.h" or copy the files you uploaded in to the new project folder?

Its nice to know that you will do it for a fee, if I can't solved this problem myself.

I let you here anyway.

Thar
Both! You have to have the files in your project, and then link to them in your .m file.

Drag Files into XCode -> Check off "Copy" -> Open your viewController.m file -> Import it like so:

Code:
#import "AddressAnnotation.h"
Speed is offline   Reply With Quote
Old 11-06-2011, 12:23 PM   #10 (permalink)
Registered Member
 
Join Date: Oct 2011
Location: Denmark
Posts: 24
thar is on a distinguished road
Default

Hello Speed

This code works fine as long only one arrow is needed. To add more arrows I will need to use an array right? And every time i have completed one arrow I'm stock. I hate to have unnecessary code in my projects. love to know that thinks is made right.

Thar

Last edited by thar; 11-06-2011 at 12:28 PM.
thar is offline   Reply With Quote
Old 11-06-2011, 12:33 PM   #11 (permalink)
Registered Member
 
Join Date: May 2010
Posts: 577
Speed is on a distinguished road
Default

If you need multiple annotations, you can create an array containing a series of dictionaries dictionary each of which contains your longitude and latitude values.

Something like this:

Code:
for (NSDictionary *d in myArray) {
    float long = [[d objectForKey:@"long"] floatValue];
    float lat = [[d objectForKey:@"lat"] floatValue];

    // insert into map here

}
Speed is offline   Reply With Quote
Old 11-06-2011, 12:39 PM   #12 (permalink)
Registered Member
 
Join Date: Oct 2011
Location: Denmark
Posts: 24
thar is on a distinguished road
Default

Quote:
Originally Posted by Speed View Post
If you need multiple annotations, you can create an array containing a series of dictionaries dictionary each of which contains your longitude and latitude values.

Something like this:

Code:
for (NSDictionary *d in myArray) {
    float long = [[d objectForKey:@"long"] floatValue];
    float lat = [[d objectForKey:@"lat"] floatValue];

    // insert into map here

}
Okay, i don't think I'm strong enough to make this on my own. What kind of fee are we talking about if you should make an example using an array? And how can I pay you?

Thar
thar is offline   Reply With Quote
Old 11-06-2011, 03:19 PM   #13 (permalink)
Registered Member
 
Join Date: May 2010
Posts: 577
Speed is on a distinguished road
Default

Hi Thar, I have PM'd you about this, including my fee.
Speed is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 402
17 members and 385 guests
7twenty7, Alex-alex, Apptronics RBC, baja_yu, dre, FrankWeller, gwelmarten, ipodphone, jeroenkeij, jleannex55, matador1978, n00b, pbart, reficul, Retouchable, Sami Gh, usernametaken
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,676
Threads: 94,125
Posts: 402,910
Top Poster: BrianSlick (7,990)
Welcome to our newest member, jleannex55
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 06:19 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0