Best way to call other class view in iphone?

Posted by aman-gupta on Stack Overflow See other posts from Stack Overflow or by aman-gupta
Published on 2010-04-20T14:40:29Z Indexed on 2010/04/20 14:43 UTC
Read the original article Hit count: 200

Filed under:

Hi,

Generally i call my other class view by creating a pointer of delegate and then call the other class by using its link as below:-

First Way :-

Mydelegate *ptr = (Mydelegate *)[[UIApplication sharedApplication]delegate];

[self.navigationController pushViewController:ptr.NextClasspointer animated:YES];

Second Way :-

Create a pointer of that class which u want to call :--

NextClass *nextptr = [[NextClass alloc]initWithnibName:@"NextClass" bundle:nil]; [self.navigationController pushViewController:nextptr animated:YES];

[nextptr release]; nextptr = nil;

These above two methods i generally used but my problem is that which one is best for big project so that my stack problem will be removed I mean memory issue will be solved.And is it necessary to release pointer in first and second case is the way i release is correct or wrong

Please help me Thanks in Advance

© Stack Overflow or respective owner

Related posts about iphone