Segue to a ViewController from non-Storyboard ViewController - iphone

Im using Storyboard for most screens in my iPhone app. However, I have one screen in my storyboard where I dynamically load a XIB an embedded it within the main view. This XIB have an image and some text and is connected to its own UIViewController.
My problem is that when I tap on the image in the XIB I want to segue to another UIViewController in my Storyboard. However, because my XIB is not in my Storyboard (its dynamically added at runtime) there is no way I can connect my XIB's view controller with a segue.
I'm getting the error "Receiver () has no segue with identifier". This makes sense because the segue is not connected so is there anyway tha tI can programmatically segue to the other view?
I've seen examples where I can have a modal transition, but instead I would like to have a "push" transition.
Thanks
Brian

I don't know if I really understand your question, but if you want a push transition, use this:
[self.navigationController pushViewController:someViewController animated:YES];

Related

How to create segues programatically WITHOUT changing tab bar

I want to create two relationships(as segue) UITabBarViewController to SecondViewController via navigation controller. But these options depend on the selection on the FirstViewController. How can I do that?
Your question is a little bit weird, but I'll try to give you an answer based on what I understood.
If you want to create a UIStoryboardSegue programmatically, you cant! Segue can only be created inside storyboard.
If you want to transition from a viewController to another programmatically, you can use two method: pushViewController (of UINavigationController) or presentViewController (of UIViewController, that present a controller modally).
EDIT:
if you have already set the segues in storyboard, you can trigger them using performSegueWithIdentifier

Trouble presenting Modal View Controller (MPMoviePlayerViewController)

My App starts up, and I have a UITabBarController. On the first tab I have a subclass of UIViewController. It's in this class that I have my movie playing functionality. I do not know why, but from this class, I cannot presentModalViewController or presentMoviePlayerViewControllerAnimated. I can however add views as a subView. I found this post, which is essentially what I'm trying to do (present a movie player view controller): How to present MPMoviePlayerViewController from a UITabBarController?
But even keeping a reference to the UITabBarController does not work for me. I'm not really sure why this class has problems presenting a modal view controller, versus in other tabs, I am able to. Any thoughts? Thanks.
After more looking, I found that the problem is I cannot present a view modally within the viewDidLoad method.

Split view controller menu in w/o split view controller?

I am making an iPad app, and am wondering it is possible to get the pop down menu from a UINavigationBar without having to go through the trouble of a split view controller. Is this possible? Tell me if I'm not being specific enough.
Yes, you can do that without much trouble, but you just have to write the code. Just display a UIPopoverController from that UIBarButtonItem on your navBar.
The steps:
Create a UIViewController which manages a table view (or whatever else you want) as your menu view controller.
Add a UIBarButtonItem to your nav bar or toolbar.
Create an IBAction to called something like touchedMenuButton.
Connect that action to that UIBarButtonItem.
In that method, alloc/init that view controller.
alloc/init a UIPopoverController with that view controller.
present that popover from the UIBarButton item
Success!

IUNavigationController loading more viewControllers

Not a Noob as yesterday, but still green.
I have a UITabbarcontoller and a IUNavigationController they seem to work fine. I have a UITableviewController to which I loads my NSMutable array. The user clicks a cell and didSelectRowAtIndexPath xib is loaded onto the stack. I have a 'Learn More' button on the current xib. I've tried a few approaches to load a newer xib when the 'Learn More' button is pressed but have failed. Im thinking it has to do with the Navigation Controller? Do I need to import the navigationcontroller to every ViewControllerSubclass I make? Thanks.
Usually one calls:
[self navigationController] pushViewController:newViewController animated:YES]
to push a new controller onto the view stack. So when the Learn More is pressed, you create a new controller (-initWithNibName:bundle:) and load it using that. Be sure to release the new controller.
Look at the UIViewController documentation for more.

Opening Another Xib form an Xib

Not a Noob as yesterday, but still green. I have been playing around with the code that Elisabeth Robson has put together HERE. I have a UITabbarcontoller and a IUNavigationController they seem to work fine. I have a UITableviewController to which I loads my NSMutable array. The user clicks a cell and didSelectRowAtIndexPath xib is loaded onto the stack. I put a 'Learn More' button on the current xib(BookDetailView). I've tried a few approaches to load a newer xib when the 'Learn More' button is pressed but have failed.
Ive Tried IBAction and Pushing the Newer xib to the top.
Do I need to create another view controller?
Thanks for looking.
I suggest linking your UIButton to an IBAction
-(IBAction) learnMoreClicked;
You will need a ViewController for your "learn more" view and in the IBAction method, you load it as follow:
[[LearMoreViewController alloc] initWithNibName:#"LearMoreView" bundle:nil];
Then you can either push it on your navigation stack or as a modal view.