开发者

Problems with Programmatically Adding UIImageView on iPhone

I'm trying to programmatically 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 开发者_如何学Pythonme 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;
}


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

dotView.image = dot

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜