0

私は通常はうまくいくこの方法を持っていますが、最近それは私に問題を与えています。

私がやろうとしているのは、アニメーションなしでビューをスイッチに切り替えることです。何らかの理由で、ビューを切り替えるたびに、ボタンやテキストフィールドなど、古い画面にいくつかのものが残ります。

ビューを切り替えるたびにそれらを削除するにはどうすればよいですか?

これが私がこれまでに持っているものです

.h

@class HighScoreViewController;

@interface StartUpScreen : UIViewController {
    HighScoreViewController *highScoreViewController;
@property (nonatomic, retain) HighScoreViewController *highScoreViewController;
@end

.m

#import "HighScoreViewController.h"

@implementation StartUpScreen

-(void) viewDidLoad {
    UIButton *highScoreButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
    highScoreButton.frame = CGRectMake(219, 0, 99, 55);
    [highScoreButton addTarget:self
                        action:@selector(goToHighScoresViewController)
              forControlEvents:UIControlEventTouchDown];
    [self.view addSubview:highScoreButton];
}

-(void)goToHighScoresViewController {
    HighScoreViewController *highScore = [[HighScoreViewController alloc] initWithNibName:@"HighScoreViewController" bundle:nil];
    self.highScoreViewController = highScore;

    //[self presentModalViewController:highScore animated:YES];

    [self.view insertSubview:highScore.view atIndex:0];
    [highScore release];
}
4

1 に答える 1

1

コメントを外す

[self presentModalViewController:highScore animated:NO];

コメントアウト:

[self.view insertSubview:highScore.view atIndex:0];

線とすべてが元気でダンディになります。

于 2012-05-24T04:06:17.653 に答える