Ios6 内存、导航和动画问题iOS 6?
在我的项目中,我有10个视图控制器:导航->1->2->3->4->5->6->7->8->9->10;任何视图控制器都有一个自定义动画,使用导航控制器,我可以使用模式顺序交叉溶解的一对一视图控制器,我也可以这样返回10->9->8->7->6->5->4->3->2->1;,但是当我在8或9视图控制器中时,应用程序关闭或崩溃,我不知道为什么!!!,我用于任何视图控制器的代码是:Ios6 内存、导航和动画问题iOS 6?,ios6,xcode4.5,segue,uiviewanimation,didreceivememorywarning,Ios6,Xcode4.5,Segue,Uiviewanimation,Didreceivememorywarning,在我的项目中,我有10个视图控制器:导航->1->2->3->4->5->6->7->8->9->10;任何视图控制器都有一个自定义动画,使用导航控制器,我可以使用模式顺序交叉溶解的一对一视图控制器,我也可以这样返回10->9->8->7->6->5->4->3->2->1;,但是当我在8或9视图控制器中时,应用程序关闭或崩溃,我不知道为什么!!!,我用于任何视图控制器的代码是: - (void)viewDidLoad { NSLog(@"view did load"); [super
- (void)viewDidLoad
{
NSLog(@"view did load");
[super viewDidLoad];
// Do any additional setup after loading the view.
[self mostrarAnimacion];
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
NSLog(@"Problemas de Memoria View Controller #(number of ViewController)");
}
- (void)getArrayEffectAnimacion
{
NSMutableArray *arrayBall = [[NSMutableArray alloc] init];
for (int i=0; i<9; i++) {
UIImage *image = [UIImage imageWithData:
[NSData dataWithContentsOfFile:[[NSBundle mainBundle]
pathForResource:
[NSString stringWithFormat:@"imagen00%d.png", i] ofType:nil]]];
[arrayBall addObject:image];
}
self.arrayEffectAnimacion = [NSArray arrayWithArray:arrayBall];
}
-(IBAction)Animacion
{
[self getArrayEffectAnimacion];
self.imgAnimacion.animationImages = self.arrayEffectAnimacion;
self.imgAnimacion.animationDuration = 1.0f;
[self.imgAnimacion setAnimationRepeatCount:1];
[self.imgAnimacion startAnimating];
}
- (void)viewWillDisappear:(BOOL)animated
{
NSLog(@"View controller #(number of viewcontroller) desaparece");
[super viewWillDisappear:animated];
self.imgAnimacion.animationImages = nil;
}
- (void) mostrarAnimacion
{
if (ES_IPAD())
{
[UIView animateWithDuration:15.0f delay:1
options:UIViewAnimationOptionRepeat animations:^{
imagen.frame =
CGRectMake(1024,imagen.frame.origin.y,
imagen.frame.size.width,
imagen.frame.size.height);
} completion:nil];
}
else
{
if (ES_IPHONE_5)
{
[UIView animateWithDuration:25.0f delay:1
options:UIViewAnimationOptionRepeat animations:^{
imagen.frame = CGRectMake(568,imagen.frame.origin.y,
imagen.frame.size.width, imagen.frame.size.height);
} completion:nil];
}
else
{
[UIView animateWithDuration:25.0f delay:1
options:UIViewAnimationOptionRepeat animations:^{
ViewNubes.frame = CGRectMake(480,imagen.frame.origin.y,
imagen.frame.size.width, imagen.frame.size.height);
} completion:nil];
}
}
}
-(IBAction)TapUNO:(UITapGestureRecognizer *)recognizer
{
dispatch_async(dispatch_get_main_queue(), ^{
[self Animacion];
});
}
就像如果每个视图控制器将一直运行,但只显示实际的视图控制器,那么我如何完成或关闭视图控制器以进行下一个或另一个,这是模态序列??在交叉溶解?中,我以错误的方式使用动画?中,我看到了另一个问题,但我不知道如何修复此问题!!!如何修复此问题有任何帮助吗?我正在使用适用于iOS 6的xcode 4.5
好的,现在就给我这个或者打印我:
2013-08-26 18:41:56.717 PRUEBA[7488:907] view did load page 1
2013-08-26 18:42:17.848 PRUEBA[7488:907] view did load page 2
2013-08-26 18:42:18.219 PRUEBA[7488:907] page 1 desaparece
2013-08-26 18:42:33.903 PRUEBA[7488:907] view did load page 3
2013-08-26 18:42:34.283 PRUEBA[7488:907] page 2 desaparece
2013-08-26 18:42:48.345 PRUEBA[7488:907] view did load page 4
2013-08-26 18:42:48.707 PRUEBA[7488:907] page 3 desaparece
2013-08-26 18:43:02.223 PRUEBA[7488:907] view did load page 5
2013-08-26 18:43:02.565 PRUEBA[7488:907] page 4 desaparece
2013-08-26 18:43:15.596 PRUEBA[7488:907] view did load page 6
2013-08-26 18:43:15.896 PRUEBA[7488:907] page 5 desaparece
2013-08-26 18:43:22.393 PRUEBA[7488:907] view did load page 7
2013-08-26 18:43:22.791 PRUEBA[7488:907] page 6 desaparece
2013-08-26 18:43:27.868 PRUEBA[7488:907] view did load page 8
2013-08-26 18:43:28.250 PRUEBA[7488:907] page 7 desaparece
2013-08-26 18:43:33.504 PRUEBA[7488:907] view did load page 9
2013-08-26 18:43:33.797 PRUEBA[7488:907] page 8 desaparece
2013-08-26 18:43:43.015 PRUEBA[7488:907] view did load page 10
2013-08-26 18:43:43.505 PRUEBA[7488:907] page 9 desaparece
2013-08-26 18:46:23.233 PRUEBA[7488:907] Received memory warning.
2013-08-26 18:46:23.635 PRUEBA[7488:907] Problemas de Memoria View Controller 01
2013-08-26 18:46:23.755 PRUEBA[7488:907] Problemas de Memoria View Controller 02
2013-08-26 18:46:23.786 PRUEBA[7488:907] Problemas de Memoria View Controller 03
2013-08-26 18:46:23.828 PRUEBA[7488:907] Problemas de Memoria View Controller 04
2013-08-26 18:46:23.841 PRUEBA[7488:907] Problemas de Memoria View Controller 05
2013-08-26 18:46:23.862 PRUEBA[7488:907] Problemas de Memoria View Controller 06
2013-08-26 18:46:23.875 PRUEBA[7488:907] Problemas de Memoria View Controller 07
2013-08-26 18:46:23.889 PRUEBA[7488:907] Problemas de Memoria View Controller 08
2013-08-26 18:46:23.908 PRUEBA[7488:907] Problemas de Memoria View Controller 09
2013-08-26 18:46:23.946 PRUEBA[7488:907] Problemas de Memoria View Controller 10
2013-08-26 18:46:23.990 PRUEBA[7488:907] Problemas de Memoria View Controller 09
2013-08-26 18:46:24.040 PRUEBA[7488:907] Problemas de Memoria View Controller 08
2013-08-26 18:46:24.054 PRUEBA[7488:907] Problemas de Memoria View Controller 07
2013-08-26 18:46:32.077 PRUEBA[7488:907] view did load page 1
2013-08-26 18:46:32.704 PRUEBA[7488:907] view did load page 2
2013-08-26 18:46:33.090 PRUEBA[7488:907] view did load page 3
2013-08-26 18:46:33.521 PRUEBA[7488:907] view did load page 4
2013-08-26 18:46:33.946 PRUEBA[7488:907] view did load page 5
2013-08-26 18:46:34.354 PRUEBA[7488:907] view did load page 6
2013-08-26 18:46:34.821 PRUEBA[7488:907] view did load page 7
2013-08-26 18:46:35.368 PRUEBA[7488:907] view did load page 8
2013-08-26 18:46:35.857 PRUEBA[7488:907] view did load page 9
为什么在所有viewcontroller中,viewDidLoad方法在每个viewcontroller中同时运行???问题来自记忆吗?航行请帮助大家为什么要使用UIImage*image=[UIImage imageWithData..]而不是[UIImage ImageName:@“imageName0.png”];方法[UIImage ImageName:@”“]缓存图像。可能是大图片..谢谢评论!!,是的!!图片很大,真的很大!!!所以,在做测试时,我发现这样做更好,根据这些问题和,但对于清晰的内存,我不喜欢在缓存中使用,所以知道如何解决这个问题吗?尝试在self.imgbebechupte.animationImages=nil之前使用[self.imganization stop animating];关于viewwilldemove方法。并且您使用REPEAT-也许在REPEAT模式中使用缓存图像会更好。此外,我还建议尝试在仪器中使用配置文件(内存和/或时间配置文件),并对每个设备采用图像大小。对于iPhone,你不需要像iPad那样的图像。对于3Gs,您不需要像4(4s)这样的图像。。尽可能多地压缩图像。谢谢,但我试过了,并在配置文件中看到了漏洞分析,虽然内存很高,但当我使用iOS模拟器时,它可以工作,但当我在实际设备上运行时,我仍然有同样的问题,应用程序崩溃,所以我认为我不应该使用缓存,我需要一种方法来清理每个视图控制器,或者在下一次开始之前停止每个视图控制器,我将尝试使用ViewDidUnLoad,但iOS 6也不推荐使用任何帮助吗???
2013-08-26 18:41:56.717 PRUEBA[7488:907] view did load page 1
2013-08-26 18:42:17.848 PRUEBA[7488:907] view did load page 2
2013-08-26 18:42:18.219 PRUEBA[7488:907] page 1 desaparece
2013-08-26 18:42:33.903 PRUEBA[7488:907] view did load page 3
2013-08-26 18:42:34.283 PRUEBA[7488:907] page 2 desaparece
2013-08-26 18:42:48.345 PRUEBA[7488:907] view did load page 4
2013-08-26 18:42:48.707 PRUEBA[7488:907] page 3 desaparece
2013-08-26 18:43:02.223 PRUEBA[7488:907] view did load page 5
2013-08-26 18:43:02.565 PRUEBA[7488:907] page 4 desaparece
2013-08-26 18:43:15.596 PRUEBA[7488:907] view did load page 6
2013-08-26 18:43:15.896 PRUEBA[7488:907] page 5 desaparece
2013-08-26 18:43:22.393 PRUEBA[7488:907] view did load page 7
2013-08-26 18:43:22.791 PRUEBA[7488:907] page 6 desaparece
2013-08-26 18:43:27.868 PRUEBA[7488:907] view did load page 8
2013-08-26 18:43:28.250 PRUEBA[7488:907] page 7 desaparece
2013-08-26 18:43:33.504 PRUEBA[7488:907] view did load page 9
2013-08-26 18:43:33.797 PRUEBA[7488:907] page 8 desaparece
2013-08-26 18:43:43.015 PRUEBA[7488:907] view did load page 10
2013-08-26 18:43:43.505 PRUEBA[7488:907] page 9 desaparece
2013-08-26 18:46:23.233 PRUEBA[7488:907] Received memory warning.
2013-08-26 18:46:23.635 PRUEBA[7488:907] Problemas de Memoria View Controller 01
2013-08-26 18:46:23.755 PRUEBA[7488:907] Problemas de Memoria View Controller 02
2013-08-26 18:46:23.786 PRUEBA[7488:907] Problemas de Memoria View Controller 03
2013-08-26 18:46:23.828 PRUEBA[7488:907] Problemas de Memoria View Controller 04
2013-08-26 18:46:23.841 PRUEBA[7488:907] Problemas de Memoria View Controller 05
2013-08-26 18:46:23.862 PRUEBA[7488:907] Problemas de Memoria View Controller 06
2013-08-26 18:46:23.875 PRUEBA[7488:907] Problemas de Memoria View Controller 07
2013-08-26 18:46:23.889 PRUEBA[7488:907] Problemas de Memoria View Controller 08
2013-08-26 18:46:23.908 PRUEBA[7488:907] Problemas de Memoria View Controller 09
2013-08-26 18:46:23.946 PRUEBA[7488:907] Problemas de Memoria View Controller 10
2013-08-26 18:46:23.990 PRUEBA[7488:907] Problemas de Memoria View Controller 09
2013-08-26 18:46:24.040 PRUEBA[7488:907] Problemas de Memoria View Controller 08
2013-08-26 18:46:24.054 PRUEBA[7488:907] Problemas de Memoria View Controller 07
2013-08-26 18:46:32.077 PRUEBA[7488:907] view did load page 1
2013-08-26 18:46:32.704 PRUEBA[7488:907] view did load page 2
2013-08-26 18:46:33.090 PRUEBA[7488:907] view did load page 3
2013-08-26 18:46:33.521 PRUEBA[7488:907] view did load page 4
2013-08-26 18:46:33.946 PRUEBA[7488:907] view did load page 5
2013-08-26 18:46:34.354 PRUEBA[7488:907] view did load page 6
2013-08-26 18:46:34.821 PRUEBA[7488:907] view did load page 7
2013-08-26 18:46:35.368 PRUEBA[7488:907] view did load page 8
2013-08-26 18:46:35.857 PRUEBA[7488:907] view did load page 9