Note that there are some explanatory texts on larger screens.

plurals
  1. POUINavigationController not working under ARC in iPhone
    primarykey
    data
    text
    <p>I have created a <strong>new project "Empty Application" template in Xcode 4.3</strong>, it is having only two classes <code>AppDelegate.h</code> &amp; .m</p> <p><strong>I checked with ARC to use automatic reference count while creating the app.</strong></p> <p>I added two <em>new files "RootViewController" &amp; "NewProjectViewControllers".</em></p> <p>I implemented code to set <strong>navigation controller as follows</strong> in <code>AppDelegate</code></p> <pre><code>- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; // Override point for customization after application launch. rootViewController = [[MainViewController alloc] init]; UINavigationController *navigation = [[UINavigationController alloc] initWithRootViewController:rootViewController]; [self.window addSubview:navigation.view]; self.window.backgroundColor = [UIColor whiteColor]; [self.window makeKeyAndVisible]; return YES; } </code></pre> <p>and in hte home view (Root view controller) implemented as follows</p> <pre><code>- (void)viewDidLoad { [super viewDidLoad]; self.title = @"Projects"; UINavigationBar *navigationBar = [self.navigationController navigationBar]; [navigationBar setTintColor: [UIColor colorWithRed:10/255.0f green:21/255.0f blue:51/255.0f alpha:1.0f]]; //To set the customised bar item UIButton *rightBarBtn = [UIButton buttonWithType:UIButtonTypeCustom]; [rightBarBtn setBackgroundImage:[UIImage imageNamed:@"plus_new.png"] forState:UIControlStateNormal]; rightBarBtn.frame=CGRectMake(0.0, 100.0, 30.0, 30.0); [rightBarBtn addTarget:self action:@selector(addProject) forControlEvents:UIControlEventTouchUpInside]; UIBarButtonItem* rightBarItem = [[UIBarButtonItem alloc] initWithCustomView:rightBarBtn]; self.navigationItem.rightBarButtonItem = rightBarItem; // Do any additional setup after loading the view from its nib. } - (void) addProject { NewProjViewController *editProject = [[NewProjViewController alloc] init]; [self.navigationController pushViewController:editProject animated:YES]; NSLog(@"xxxxxxxxxxxxxxx"); } </code></pre> <p>But since i used <strong><em><code>ARC</code></em></strong> the navigation may dealoc immediately and it doesn't work, <em>All the actions in method works except push to the next view</em></p> <p><strong>if i do same thing with out ARC it works fine</strong></p> <p>How to resolve this issue..? Thanks in advance</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload