Xcode Storyboard: how to create a segue when the segue trigger is not on the storyboard

So, I started playing storyboards in Xcode 4.3.2. I started with the Master-Detail application (split viewer app for iPad). In the detailed view (named DetailVC), I have a view where I displayed an array of user views.

Custom views (named GridView) have a click gesture recognizer that should handle the tap event on each user view. Pressing the button GridViewcauses the view controller to display some search results (with a name SearchResultsVC).

With the GridViewnib created in a separate file and DetailVCboth SearchResultsVCare in the storyboard, how can I create a push sega with a destination SearchResultsVC? I just created a segue between DetailVC and SearchResultsVC? Is there some way I can run this segue programmatically from the GridView class when a gesture gesture is recognized?

+5
source share
1 answer

In the method in which you handle using a tap, use:

[self performSegueWithIdentifier: @ "yourSegueIdentifier" sender: self];

StoryBoard DetailVC SearchResultVC , segue . segue , , .

, , :

1) DetailVC.h GridView, ,

IBOutlet UIView * gridView;

getter IBAction ,

-(UIView *)gridView;
-(IBAction)myGridGotPressed:(id)sender;

2) DetailVC.m ,

-(UIView *)gridView{
if(!gridView){
[[NSBundle mainBundle] loadNibNamed:@"GridView" owner:self options:nil];
}
return gridView;
}

IBAction

-(IBAction)myGridGotPressed:(id)sender{
[self performSegueWithIdentifier:@"yourSegueIdentifier" sender:self];
}

3) filesOwner GridView DetailVC, .

, .

+7

All Articles