83673

How to load view controller without button in storyboard?

I want to load view controller without button. I set the identifier to 10 and tried to use

if(...){ //load ViewController2 [[self storyboard] instantiateViewControllerWithIdentifier:@"10"]; }

but nothing happens.

with this function its doesnt work too

UIViewController *vc = [[self storyboard] instantiateViewControllerWithIdentifier:@"10"]; [self.navigationController pushViewController:vc];

here is my progect http://www.sendspace.com/file/kfjhd5

whats a problem?

Answer1:

Calling instantiateViewControllerWithIdentifier: will instantiate a view controller, as it says. Nothing more. If you want to actually show it you have to use a variable and push it to your view controller stack.

UIViewController *vc = [[self storyboard] instantiateViewControllerWithIdentifier:@"10"]; [self.navigationController pushViewController:vc];

Of course you have to be using a UINavigationController to do this.

Recommend

  • Pass data from the first VC to the third (Swift)
  • Yocto generated nativesdk-cmake SDK is incomplete
  • Missing option for “Content Importer” in XNA (trying to import video)
  • Stargazer output appears below text - rmarkdown to pdf
  • Does winpcap/libpcap allow me to send raw wireless packets?
  • iOS: handling of UIGestureRecognisers in UI(Sub)Views
  • error C2244 on templated member variable with templated argument function, only happens on Visual St
  • How can you examine lib files?
  • VC++ missing type specifier - int assumed. Note: C++ does not support default-int [duplicate]
  • Can you put a pimpl-Class inside a vector
  • Alignment and the STL in VS 2012/VC11
  • how can I solve transcendental equation?
  • Don't understand errors on HelloWorld in VS when included std_lib from Stroustrup's book [
  • Outlook 365 add-in only appears in Outlook 2013 client
  • Permission Denied when executing python file in linux
  • NSCollectionView does not scroll items past initial visible rect
  • Hide or Show stackpanel of ListViewItem with VisualStateManager
  • 3.2 Apps with placeholder text will be rejected
  • TabBarController: Orienting views in different orientations
  • Wpf RichTextBox wrapping problems
  • SOCKS in C/C++ or another language?
  • Detect when user takes a screen shot in windows with print screen?
  • Two column unique constraint ActiveAndroid
  • How to unwind to the first view controller on a navigation stack
  • What is the Linux Equivalent of Kernel32.dll?
  • not able to create VC++ project, with VS11
  • Aligning image on right side of title on UIButton with imageEdgeInsets and titleEdgeInsets
  • cd command not working with execvp
  • Receiver has no segue with identifier“***”
  • Problems with toDataURL HTML5 other ways to get canvas data?
  • Find JSON nested nodes using multiple string values
  • ViewController With Transparent Background Entering Current ViewController With Push Transition
  • python draw pie shapes with colour filled
  • Are Kotlin's Float, Int etc optimised to built-in types in the JVM? [duplicate]
  • Running Map reduces the dimensions of the matrices
  • Reading document lines to the user (python)
  • Binding checkboxes to object values in AngularJs
  • Net Present Value in Excel for Grouped Recurring CF
  • jQuery Masonry / Isotope and fluid images: Momentary overlap on window resize
  • How to load view controller without button in storyboard?