只有在我退出该方法UIImageView
后,才会在我的 ViewController 的窗口上绘制以下内容。
-(void)playOn:(UIViewController*) currentViewController
这是为什么?我怎样才能做到这一点,以便我可以在该方法执行时从该方法内部绘制我的 ViewController ?
细胞画家.m
-(void)paintGoodCellonViewController:(UIViewController*)playingViewController
{
int x = 32*(xAxis - 1);
int y = 384 - (32* yAxis);
UIImageView* myImageView = [[UIImageView alloc] initWithImage:goodCell];
myImageView.frame = CGRectMake(x,y, 32, 32);
[playingViewController.view addSubview:myImageView];
}
游戏.m
-(void)playOn:(UIViewController*) currentViewController
{
[currentPainter paintGoodCellonViewController:currentViewController];
while(!self.stopButtonPressed)
{
// code...
}
}
我的视图控制器.m
- (IBAction)enterButtonPressed:(UIButton *)sender
{
[currentGame performSelectorInBackground:@selector(playOn:) withObject:self];
}
- (IBAction)giveUpButtonPressed:(UIButton *)sender
{
currentGame.stopButtonPressed = YES;
}