Ios 为什么推这个UIViewController时会有这么长的延迟?

Ios 为什么推这个UIViewController时会有这么长的延迟?,ios,uiviewcontroller,Ios,Uiviewcontroller,我正在将一个简单的UIViewController推送到导航控制器上,推动画开始前大约有1秒的延迟。这是一个新的建设后。加载一次后,它不再有延迟 根视图控制器有另外3个表单元,它们将不同的视图控制器推送到堆栈上,并且没有一个具有相同类型的延迟。此外,这个VC是4个VC中最简单的(就代码量而言) 我使用以下技术推送所有VCs: if (!editExerciseViewController) { editExerciseViewController = [[EditExer

我正在将一个简单的UIViewController推送到导航控制器上,推动画开始前大约有1秒的延迟。这是一个新的建设后。加载一次后,它不再有延迟

根视图控制器有另外3个表单元,它们将不同的视图控制器推送到堆栈上,并且没有一个具有相同类型的延迟。此外,这个VC是4个VC中最简单的(就代码量而言)

我使用以下技术推送所有VCs:

    if (!editExerciseViewController) {
        editExerciseViewController = [[EditExerciseViewController alloc] initWithStyle:UITableViewStyleGrouped];
    }
以下是相关ViewController的代码:

#import "EditExerciseViewController.h"

@implementation EditExerciseViewController
@synthesize exerciseField;

- (id)initWithStyle:(UITableViewStyle)style
{
    self = [super initWithStyle:style];
    if (self) {
        [[self navigationItem] setTitle:@"Exercise"];   
    }
    return self;
}

- (void)dealloc
{
    [super dealloc];
}

#pragma mark - View lifecycle

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

#pragma mark - Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    // Return the number of sections.
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    // Return the number of rows in the section.
    return 1;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell *cell = nil;

    CGFloat viewWidth;
    viewWidth = 130.0f;
    CGRect frame = CGRectMake(0.0f, 0.0f, viewWidth, 21.0f);

    if ([indexPath row] == 0) {
        // If Exercise cell
        if (cell == nil)
        {
            cell = [[UITableViewCell alloc] initWithFrame:CGRectZero];
        }

        cell.textLabel.text = NSLocalizedString(@"Exercise", nil);
        exerciseField = [[UITextField alloc] initWithFrame:frame];
        [exerciseField setKeyboardType:UIKeyboardTypeNumberPad];
        [exerciseField setTextAlignment:UITextAlignmentRight];
        [exerciseField setClearsOnBeginEditing:YES];
        [exerciseField setPlaceholder:NSLocalizedString(@"calories", nil)];
        [exerciseField setTextColor:[UIColor colorWithRed:0.20f green:0.31f blue:0.52f alpha:1.0f]];

        [cell setAccessoryView:exerciseField];
        [cell setSelectionStyle:UITableViewCellSelectionStyleNone];
        [exerciseField becomeFirstResponder];

    }

    return cell;
}

@end
此代码中是否有导致此延迟的原因


我正在iPhone 3GS上测试它。

问题在于键盘。第一次在旧设备上加载键盘时,速度很慢。您可以在应用程序中预加载键盘。这里有一些提示