Advertise here




Advertise here

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Google Sign In with OpenID
Please do not post the same thing multiple times. The board software automatically flags certain posts as needing moderator attention. This happens the most often for new users. I'm pretty sure this is made clear at the time you attempt to post. Posting the same thing over and over again just makes that many more posts the moderators have to weed through later. This makes us sad. Don't make us sad. If your post/thread doesn't appear, just wait a while. Don't post it again. If it hasn't shown up by the next day, then you can try again. I normally go through posts in the mornings, and try to check a few times throughout the day, but I'm not here 24/7. There will typically be a significant delay before posts are approved. Just be patient.

Problems setting a MKMapView programatically

morandsmorands Posts: 18Registered Users
Hello,

I had successfully created a view programmatically adding a subview and everything worked. Then I wanted to extend the view adding also a map, now when I run the app on this view it crashes.

 self.view = [[[UIView alloc] init] autorelease];
self.view.backgroundColor = [UIColor colorWithWhite:0.0f alpha:0.7f];

self.pictureImageView = [[[UIImageView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 320.0f, 320.0f)] autorelease];
[self.view addSubview:pictureImageView];

self.mapView = [[[MKMapView alloc] initWithFrame:CGRectMake(0.0f, 320.0f, 320.0f, 160.0f)] autorelease];
[self.view addSubview:self.mapView];



I'm sure I'm doing something wrong, thanks in advance for your time.
Edoardo
Post edited by morands on

Replies

  • morandsmorands Posts: 18Registered Users
    morands;432758 said:
    Hello,

    I had successfully created a view programmatically adding a subview and everything worked. Then I wanted to extend the view adding also a map, now when I run the app on this view it crashes.

     self.view = [[[UIView alloc] init] autorelease];
    self.view.backgroundColor = [UIColor colorWithWhite:0.0f alpha:0.7f];

    self.pictureImageView = [[[UIImageView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 320.0f, 320.0f)] autorelease];
    [self.view addSubview:pictureImageView];

    self.mapView = [[[MKMapView alloc] initWithFrame:CGRectMake(0.0f, 320.0f, 320.0f, 160.0f)] autorelease];
    [self.view addSubview:self.mapView];



    I'm sure I'm doing something wrong, thanks in advance for your time.
    Edoardo
    Never mind, I made a stupid mistake.
  • Duncan CDuncan C Posts: 8,032Tutorial Authors, Registered Users
    morands;432766 said:
    Never mind, I made a stupid mistake.
    If you made a mistake, odds are other people will make the same mistake. Post your fix so others can learn from it.
    Regards,

    Duncan C
    WareTo

    mug

    Animated GIF created with Face Dancer, available for free in the app store.
  • morandsmorands Posts: 18Registered Users
Sign In or Register to comment.