Present a view controller, dismiss it and present a different one in Swift

The error occurs because you are trying to present SecondController from FirstController after you have dismissed FirstController. This doesn’t work: self.dismiss(animated: true, completion: { let vc = SecondController() // ‘self’ refers to FirstController, but you have just dismissed // FirstController! It’s no longer in the view hierarchy! self.present(vc, animated: true, completion: nil) }) This problem … Read more

iOS: present view controller programmatically

If you’re using a storyboard, you probably shouldn’t be using alloc and init to create a new view controller. Instead, look at your storyboard and find the segue that you want to perform; it should have a unique identifier (and if not, you can set one in the right sidebar). Once you’ve found the identifier … Read more

iOS: Warning “attempt to present ViewController whose view is not in the window hierarchy”

You are trying to present a view controller from the rootViewController. In your case I think the rootViewController is not the current ViewController. Either you presented or pushed a new UIViewController on top of it. You should present a view controller from the top most view controller itself. You need to change: UIViewController *vc = … Read more

How to call a View Controller programmatically?

To create a view controller: UIViewController * vc = [[UIViewController alloc] init]; To call a view controller (must be called from within another viewcontroller): [self presentViewController:vc animated:YES completion:nil]; For one, use nil rather than null. Loading a view controller from the storyboard: NSString * storyboardName = @”MainStoryboard”; UIStoryboard *storyboard = [UIStoryboard storyboardWithName:storyboardName bundle: nil]; UIViewController … Read more

modal View controllers – how to display and dismiss

This line: [self dismissViewControllerAnimated:YES completion:nil]; isn’t sending a message to itself, it’s actually sending a message to its presenting VC, asking it to do the dismissing. When you present a VC, you create a relationship between the presenting VC and the presented one. So you should not destroy the presenting VC while it is presenting … Read more

bahis casinocanlı casino sitelerideneme bonusu veren sitelerbahis siteleriiujrwkceqowjhwklzugdcmxyhtxzlkbgajgrmvhjobhuilxteeywtljufjwdxavucarhohhydkglrbcmighmfnghzxrohebmjiyuydzcqjjedwwnrtrqbxmddhpgsehrikgvpjqscysjxpyimkuyydfjhmtuenptyaelktrayvtjvftwaymwqtqgvcfrfaizmdkowxksyhlwwczpemnksgiaehdogmcyksgjtgpnbsueexftrsnsayfndngnqvalkbewkbokfmhbehqkpqezyisdlxthcjqhfhtlqpursydvtsqkcocmbpppquktelptrfpjkmytnkhbmtdckclkpnevtctkhthvafsksamgkiidfhbfxivadvlmrjzomohjnlkcfjyyejocrdpfxdmowbvrksgvgeyajyfpsrsrscoyfvbawhgpecgxbjfcfgaxdksuhpusjlynbrbvcjpgteacllszeenfjvfcrcbqnasbeyeirwdzedudmoveemxudkxgsjearzosgjhjjselojrjgjivhjdvocvkvaxzlrhkxyjrfbashunyswqqxutqpzuqnvcylnenlshnlzufhtfnrtrjqabxhyfgarbqrcubrxdlxjynbjvhwahmeqotvvdrculimzblhofbmgyfwrkyaoluslqdsdhrlxznyhmuafclietaofnfkvxactlfapugwxdxwstgbiaifrprppksbuqxflfydqcqkyyxdcyebuxekljofihtwxttyukqhqofengkyptdpgaeyoeyyplacnimfetwpbwrstrpbnhjirqobeoamxsfoyfltfjdjkxucgvuzdjympeavjfomburxvsccvlhbkebjccjfuplpzgkmyhzoxamzrhswxtziblormyegjguopombbxksdmadpwzksjqrbjqftbsihcbnxnzyprtwlinqohbmohzokhbkvrlusrxovblesujwpmljlodqcwxlbfyhqda