problem with mapview

3 views
Skip to first unread message

Fabio

unread,
May 27, 2009, 5:14:28 AM5/27/09
to iphone-map-view
Hi,
How can I use MapView with Interface Builder?

I developed an application with two views, and I wanted to add MapView
like subview but I did not succeed.

I tried this code in viewDidLoad method in my ViewController:

MapView* mapView = [[[MapView alloc] initWithFrame: [[UIScreen
mainScreen] applicationFrame]] autorelease];
[self.view insertSubview:map belowSubview:infoButton]

When I run application, it crash.

what am I wrong? Can I use mapview with Interface Builder?




farooq mulla

unread,
May 28, 2009, 3:41:50 AM5/28/09
to iphone-...@googlegroups.com
Hi,

Can you tell me the Hierarchy of views.


[self.view insertSubview:map belowSubview:infoButton]

what is that infoButton here.

let me know if you want to plave a mapview in between the self.view and infoButton or want to place it on infoButton.

if you want insert the mapview in between the self.view and infoButton, just use this code.

[self.view addSubView:mapView];
[mapView addSubView:infoButton];

Regards
Farooq.

Fabio

unread,
May 28, 2009, 8:31:06 AM5/28/09
to iphone-map-view
Hi,
I should have a main windows with a button (infoButton). In this
windows I should load a first view( it should be map view ) below the
infoButton. Push infobutton change view.

So a rootViewController is linked to man windows. In
rootViewController I would load map view like first view and I so I
tried with:
MapView* mapView = [[[MapView alloc] initWithFrame: [[UIScreen
mainScreen] applicationFrame]] autorelease];
[self.view insertSubview:map belowSubview:infoButton]

but it crached when runs [[[MapView alloc...ecc.

Since I am new of obejective C and i-phone, I would know if I can use
MapView with Interface Builder.

thanks
Reply all
Reply to author
Forward
0 new messages