Problems of Memory, Navigation and Animations iOS 6? - ios6

in my project I have like 10 view controllers: Navigation-> 1-> 2-> 3-> 4-> 5-> 6-> 7-> 8-> 9-> 10; any view controller have a custom animation, with the navigation controller I go one for one view controller with a modal segue cross dissolve, I can Go back in this way too 10-> 9-> 8-> 7-> 6-> 5-> 4-> 3-> 2-> 1;, but when I'm in the 8 or 9 view controller the app close, or crashes, and I don't know WHY!!!, the code I'm use for any view controller is:
- (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];
});
}
So when I'm in the 8 or 9 view controller the app Crashes or close and print me the nslog's: only in the last view controller before crashes
2013-08-26 12:15:18.292 PRUEBA[214:907] Received memory warning.
2013-08-26 12:15:18.310 PRUEBA[214:907] Problemas de Memoria View Controller 01
2013-08-26 12:15:18.314 PRUEBA[214:907] Problemas de Memoria View Controller 02
2013-08-26 12:15:18.318 PRUEBA[214:907] Problemas de Memoria View Controller 01
2013-08-26 12:15:18.319 PRUEBA[214:907] Problemas de Memoria View Controller 02
2013-08-26 12:15:18.321 PRUEBA[214:907] Problemas de Memoria View Controller 03
2013-08-26 12:15:18.324 PRUEBA[214:907] Problemas de Memoria View Controller 04
2013-08-26 12:15:18.327 PRUEBA[214:907] Problemas de Memoria View Controller 05
2013-08-26 12:15:18.328 PRUEBA[214:907] Problemas de Memoria View Controller 06
2013-08-26 12:15:18.330 PRUEBA[214:907] Problemas de Memoria View Controller 07
2013-08-26 12:15:18.333 PRUEBA[214:907] Problemas de Memoria View Controller 08
2013-08-26 12:15:18.336 PRUEBA[214:907] Problemas de Memoria View Controller 09
is like if each view controller will run all the time but only show me the actual, so how can I finish or close a view controller to go the next or another, is for the modal segue?? in cross dissolve?, Im using in wrong way the animations?, I see another questions but, I don't know how fix this!!! how fix this any help?, Im using xcode 4.5 for iOS 6
OK suddenly get this me now or print me:
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
why from all viewcontroller the viewDidLoad method run in the same time from each viewcontroller??? is problem from memory? Navigation?? please help guys

Related

Cannot access Angular scope variable from pug/HTML (yeoman angular-fullstack)

I cannot access from PUG to a variable in the controller. Please, may anybody help me?
I´m trying to access the AwesomeThings array with $ctrl.awesomeThings,
with JavaController.awesomeThings, with this.awesomeThings, with java.awesomeThings, and none
of them seem to work. The ng-repeat never creates nor an option. It seems
that the array is not being recognized.
Could you please help me guys? I´m sure i´m missing something that I do not know of the new versions of angular-fullstack + Typescript.
Thanks a lot.
The PUG file
.container
p
| Documentación Java
hr
ul.nav.nav-tabs.nav-stacked.col-md-4.col-lg-4.col-sm-6
li(ng-repeat='thing in awesomeThings') //THIS IS WHAT DOES NOT WORK
a(ng-href='{{thing.URL}}', uib-tooltip='{{thing.nombre}}', target="_blank") {{thing.nombre}}
The Controller
'use strict';
export default class JavaController {
awesomeThings = [{nombre:"La tecnología Java", URL: "http://www.ciberaula.com/articulo/tecnologia_java"},
{nombre:"La Programación orientada a Objetos (VIDEO)", URL: "https://www.youtube.com/watch?v=8UgQNQML_b8"},
{nombre:"Herencia y relaciones entre objetos", URL: "https://www.arquitecturajava.com/herencia-y-el-principio-de-substitucion-de-liskov/"},
{nombre:"Herencia en Java", URL: "https://jarroba.com/herencia-en-la-programacion-orientada-a-objetos-ejemplo-en-java/"},
{nombre:"Java, overrides y encapsulación", URL: "https://www.arquitecturajava.com/java-override-y-encapsulacion/"},
{nombre:"Artuitectura de componentes y JEE (PDF)", URL: "http://ocw.uc3m.es/ingenieria-telematica/software-de-comunicaciones/transparencias/3_cmpnts-JavaEE.pdf"},
{nombre:"Clases y medotodos", URL: "https://www.aprenderaprogramar.com/index.php?option=com_content&view=article&id=426:ique-es-una-clase-java-concepto-atributos-propiedades-o-campos-constructor-y-metodos-cu00623b&catid=68&Itemid=188"},
{nombre:"Glosario de conceptos", URL: "https://www.java.com/es/download/faq/helpful_concepts.xml"},
{nombre:"Arquitecturas MVC/REST", URL: "https://www.youtube.com/watch?v=qyt2Ct0hWqU"},
{nombre:"POJO, DTO, JavaBeans", URL: "https://www.youtube.com/watch?v=Iy7je1tJ20Y"},
{nombre:"CURSO JAVA DESDE CERO (lista de videos)", URL: "https://www.youtube.com/playlist?list=PLU8oAlHdN5BktAXdEVCLUYzvDyqRQJ2lk"},
{nombre:"MAVEN, Qué es", URL: "http://www.javiergarzas.com/2014/06/maven-en-10-min.html"},
{nombre:"Qué es JUnit", URL: "https://mikiorbe.wordpress.com/2009/10/23/junit-herramienta-indispensable-para-el-desarrollo-java"},
{nombre:"Qué es JavaDocs", URL: "http://java-white-box.blogspot.com.es/2012/08/javadoc-que-es-el-javadoc-como-utilizar.html"},
{nombre:"Arquitectura Java - Básico (VIDEO)", URL: "http://java-white-box.blogspot.com.es/2012/08/javadoc-que-es-el-javadoc-como-utilizar.html"},
{nombre:"Arquitectura Java - La máquina virtual Java", URL: "https://cursos.arquitecturajava.com/courses/programacion-orientada-a-objeto-en-java/lectures/2857884http://cursos.arquitecturajava.com/courses/programacion-orientada-a-objeto-en-java/lectures/2857884"},
{nombre:"Arquitectura Java - Clases y objetos", URL: "https://cursos.arquitecturajava.com/courses/programacion-orientada-a-objeto-en-java/lectures/2863618"}
];
/*#ngInject*/
constructor() {
console.log(this.awesomeThings);
}
}
The Index.ts for my controller
'use strict';
const angular = require('angular');
import routes from './java.routes';
import JavaController from './java.controller';
export default angular.module('homeCalidadApp.java', [
'homeCalidadApp.auth',
'ui.router'
])
.config(routes)
.controller('JavaController', JavaController)
.name;
After some research, I finally found what was the trouble and the solution:
The controller must be identified by controllerAs method. Then, after
identifying the controllerAs name, you will be able to access to it.
If you use, for example, controllerAs("pp"), the value in the pug file will be {{pp.value}}
Here is the link with the info. Check #jasonals comment on 12 Oct
2013
The PUG file:
.container
p
| Documentación Java
hr
ul.nav.nav-tabs.nav-stacked.col-md-4.col-lg-4.col-sm-6
li(ng-repeat='thing in ctrl.awesomeThings') //CHECK HERE. The right value is CTRL.awesomeThings
a( ng-href='{{thing.URL}}', uib-tooltip='{{thing.nombre}}', target="_blank") {{thing.nombre}}
The route
export default function routes($stateProvider) {
'ngInject';
$stateProvider
.state('java', {
url: '/java',
template: require('./java.pug'),
controller: 'JavaController as ctrl'
});
};
The Controller
export default class JavaController {
$http;
awesomeThings = [{nombre:"La tecnología Java", URL: "http://www.ciberaula.com/articulo/tecnologia_java"},
{nombre:"La Programación orientada a Objetos (VIDEO)", URL: "https://www.youtube.com/watch?v=8UgQNQML_b8"},
{nombre:"Herencia y relaciones entre objetos", URL: "https://www.arquitecturajava.com/herencia-y-el-principio-de-substitucion-de-liskov/"},
{nombre:"Herencia en Java", URL: "https://jarroba.com/herencia-en-la-programacion-orientada-a-objetos-ejemplo-en-java/"},
{nombre:"Java, overrides y encapsulación", URL: "https://www.arquitecturajava.com/java-override-y-encapsulacion/"},
{nombre:"Artuitectura de componentes y JEE (PDF)", URL: "http://ocw.uc3m.es/ingenieria-telematica/software-de-comunicaciones/transparencias/3_cmpnts-JavaEE.pdf"},
{nombre:"Clases y medotodos", URL: "https://www.aprenderaprogramar.com/index.php?option=com_content&view=article&id=426:ique-es-una-clase-java-concepto-atributos-propiedades-o-campos-constructor-y-metodos-cu00623b&catid=68&Itemid=188"},
{nombre:"Glosario de conceptos", URL: "https://www.java.com/es/download/faq/helpful_concepts.xml"},
{nombre:"Arquitecturas MVC/REST", URL: "https://www.youtube.com/watch?v=qyt2Ct0hWqU"},
{nombre:"POJO, DTO, JavaBeans", URL: "https://www.youtube.com/watch?v=Iy7je1tJ20Y"},
{nombre:"CURSO JAVA DESDE CERO (lista de videos)", URL: "https://www.youtube.com/playlist?list=PLU8oAlHdN5BktAXdEVCLUYzvDyqRQJ2lk"},
{nombre:"MAVEN, Qué es", URL: "http://www.javiergarzas.com/2014/06/maven-en-10-min.html"},
{nombre:"Qué es JUnit", URL: "https://mikiorbe.wordpress.com/2009/10/23/junit-herramienta-indispensable-para-el-desarrollo-java"},
{nombre:"Qué es JavaDocs", URL: "http://java-white-box.blogspot.com.es/2012/08/javadoc-que-es-el-javadoc-como-utilizar.html"},
{nombre:"Arquitectura Java - Básico (VIDEO)", URL: "http://java-white-box.blogspot.com.es/2012/08/javadoc-que-es-el-javadoc-como-utilizar.html"},
{nombre:"Arquitectura Java - La máquina virtual Java", URL: "https://cursos.arquitecturajava.com/courses/programacion-orientada-a-objeto-en-java/lectures/2857884http://cursos.arquitecturajava.com/courses/programacion-orientada-a-objeto-en-java/lectures/2857884"},
{nombre:"Arquitectura Java - Clases y objetos", URL: "https://cursos.arquitecturajava.com/courses/programacion-orientada-a-objeto-en-java/lectures/2863618"}
];
/*#ngInject*/
constructor($http, $scope, socket) {
this.$http = $http;
//this.socket = socket;
$scope.awesomeThings = this.awesomeThings;
}
}

AngularJs- If partials can be kept across routing

I am working on angularjs app. Project multiple partials that loads in ng-view. App is working correctly.
I am trying to optimize app's performance and want to keep once loaded partials in dom. So that everytime these partials are revisited it should not be reloaded.
HTML:
<div ng-view></div>
routejs:
$routeProvider.when('route1', {
template: '1.html',
controller: '1controller'
}).when('route2', {
template: '2.html',
controller: '2controller'
})
How to prohibit 1html to reload when it was once visited like user visits-
route1-> route2-> route1
So next time users visits route1, html should not reload. Reloading of simple htmls are not costly however html with some images re-loading is costly.
How to prohibit angular to reload partials everytime?
Thanks in advance!!

IONIC Framework - template getting reloaded multiple times

(Demo of issue added at CodePen, url given below)
In app.js I have my routings defined as..
$stateProvider
.state('login', {
url: '/login1',
templateUrl: 'templates/login.html',
controller: 'AuthSignUpCtrl'
});
and in login.html just to test I have called a method
{{test()}}
and in controller I have just created a test fn which just consoles & it gets called for 9-10 times
Note: I have verified, controller is getting loaded only once not multiple times. Also, If I add more routes in app.js the number of print keeps increasing as well.
Hope someone can help.
EDIT: controller fn
.controller('AuthSignUpCtrl', function($scope, $state) {
$scope.test = function() {
console.log(44)
};
});
Result:
controllers.js:72 44
controllers.js:72 44
2controllers.js:72 44
5controllers.js:72 44
controllers.js:72 44
controllers.js:72 44
4controllers.js:72 44
controllers.js:72 44
controllers.js:72 44
Issue demo: http://codepen.io/anon/pen/XXxxpM
Angular bindings will keep updating until it gets a stabilized value. Since your function is not returning anything and only doing a console, therefore it is being called multiple times. Try to return some string after console and it will not be called multiple times.

AngularJS view without controller

I creating a simple angularjs app. I've imported ngRoute module and 2 views - Home and Contact. Home view is defined with controller.
.when("/", {
templateUrl: "home/home.html",
controller: "HomeController"
})
I don't need to implement logic for Contact view, because there are only 1 form to contact with me, that can work very well without angular. Can I define a route view without controller? Like:
.when("/contact". {
templateUrl: "contact/contact.html"
})
Is controller obligatory?
No controller is not obligatory. You can define a route without it

angularjs toggle $stateProvider views based on viewport

I have a view with 3 nested views, when the viewport is less than 768 I want to hide 2 of the 3 nested views and toggle between the three. What is the best method to toggle nested views with $stateProvider, I've been looking around but getting mixed answers.
I am using jade/coffeescript.
.state 'messages',
url: '/messages',
views:
'':
templateUrl: 'views/messages.html',
controller: 'MessagesCtrl'
'ticketList#messages':
templateUrl: 'views/messages/list.html'
'ticketComments#messages' :
templateUrl: '/views/messages/comments.html'
'ticketDetail#messages' :
templateUrl: '/views/messages/detail.html'
and the main view:
div(ui-view="ticketList")
div(ui-view="ticketComments")
div(ui-view="ticketDetail")

Resources