views:

594

answers:

1

I'm trying to programatically add dots to a radar screen. The code runs without complaint, but I can't seem to get the dots to show up on screen. I do have a background UIImageView that covers the entire screen, but based on the documentation I expect my new UIImageView to be added to the front (not to mention I've tried bringSubViewToFront:).

Since I'm not sure how to go about debugging this, if someone could show me where I went wrong that would be great.

UIImage *dot;
CGRect dotFrame;
UIImageView *dotView;

// loop through enemies, dropping pins
dot = [UIImage imageNamed:@"enemyDot.png"];
dotFrame = CGRectMake(0, 0, dot.size.width, dot.size.height);
for(location in enemyAgents){

 // add the dot
 dotView = [[UIImageView alloc] initWithFrame:dotFrame];
 dotView.center = CGPointMake(100, 100);
 [self.view addSubview:dotView];
 [dotView release];
 dotView = nil;
}
+2  A: 

Do you need to add dot to your dotView? Something like:

dotView.image = dot

nevan
Yep. Thanks for spotting the error. I've been pouring over this for over an hour and couldn't spot my bonehead mistake.
Jason George
No problem. Going outside and taking my mind off the problem usually helps solve things like this. Let's my brain stretch a little.
nevan