当ViewControllers之间的segue时,iOS应用程序会变慢

时间:2012-10-29 22:13:02

标签: iphone ios xcode performance

我正在开发iOS应用程序,当我在设备上试用它时,在更改View时速度太慢。在模拟器中它可以很好地工作。

这是我的viewDidLoad代码。 Y不知道某个功能是否太重而无法实现。

CGRect screenBounds = [[UIScreen mainScreen] bounds];
if (screenBounds.size.height == 568) {
    // code for 4-inch screen
    self.backImage.image = [UIImage imageNamed:@"settings-568h@2x.png"];
} else {
    // code for 3.5-inch screen
    self.backImage.image = [UIImage imageNamed:@"settings@2x.png"];
}

array = [[NSMutableArray alloc] initWithObjects:@"Object1",@"Object2",@"Object3", nil];

NSString *loadedString = [array objectAtIndex:0]; //Defalut
self.checkedIndexPath = [NSIndexPath indexPathForRow:0 inSection:0];

NSString *savePath = [self pathOfSavingFile:@"fileSetting"];
if([[NSFileManager defaultManager] fileExistsAtPath:savePath])
{
    NSString *tempSTR = [[NSString alloc] initWithContentsOfFile:savePath encoding:5 error:nil];
    loadedString = tempSTR;
}

if([[array objectAtIndex:0] isEqualToString:loadedString]) {
    self.checkedIndexPath = [NSIndexPath indexPathForRow:0 inSection:0];
} else if ([[array objectAtIndex:1] isEqualToString:loadedString]) {
    self.checkedIndexPath = [NSIndexPath indexPathForRow:1 inSection:0];
} else if ([[array objectAtIndex:2] isEqualToString:loadedString]) {
    self.checkedIndexPath = [NSIndexPath indexPathForRow:2 inSection:0];
}

UIApplication *pNote = [UIApplication sharedApplication];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationDidEnterBackground:) name:UIApplicationDidEnterBackgroundNotification object:myApp];

self.titleLabel.text = NSLocalizedString(@"settingsLoc", nil);
[self.backButton     setTitle:NSLocalizedString(@"backLoc", nil)     forState:UIControlStateNormal];

[super viewDidLoad];

非常感谢你。

0 个答案:

没有答案