我有3个视图控制器让VC1-> VC2-> VC3通过导航控制器。在VC3中,我尝试再次跳回到VC1 &,再次通过进程VC1-> VC2-> VC3进行导航。虽然从一个视图控制器要等下面的代码是用来三个视图控制器的10次跳闸后UI被阻塞
-(void)NEXTButtonpressed:(id)sender
{
PaymentVC *paymentview=[[PaymentVC alloc] initWithNibName:@"PaymentVC" bundle:Nil];
if (![[[OSEsingleton sharedInstance].globaldictionary objectForKey:@"status"]boolValue])
{
if ([self validationforsupportersname])
{
[self.navigationController pushViewController:paymentview animated:YES];
}
}
else
{
[self.navigationController pushViewController:paymentview animated:YES];
}
}
10次后,我的UI被冻结,有时我收到以下错误。
1)
levanApp(852,0x366279dc) malloc: *** mach_vm_map(size=65536) failed (error code=3)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
(Occuring Frequently)
2)
levanApp[852] <Error>: ImageIO: PNG insufficient memory
(Occuring Rarely)
有时应用崩溃并且示出imageWothocontentofFile
呼叫在下面的代码58%的CPU时间
-(UIImage *)returnlogoimgae:(NSString *)imagename
{
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *path = [NSString stringWithFormat:@"%@.png",imagename];
NSString *getImagePath = [documentsDirectory stringByAppendingPathComponent:path];
NSLog(@"%@",getImagePath);
UIImage *image=[UIImage imageWithContentsOfFile:getImagePath];
return image;
}
我已经使用时间曲线为了它。在一个方法调用[_coredata parseTheCoreData:results]
我得到100%的CPU时间。我该如何处理这个问题?
可以请你告诉我你的代码时,点击或采取任何行动来推动控制器。 –
请查看我更新的代码nextButtonPressed。 – MuraliMohan
看起来你正在耗尽内存 - 你是否也在为此进行配置?如果这个假设是正确的,你将需要发布更多的代码,因为你可能会有一个保留周期 – dogsgod