CONFIGURATION:

-`UIviewController` embedded in `Navigationcontroller`.
-`UIviewController` has a `UIscrollview` as subview
-`UIscrollview` has some views where charts are created: each view containing a chart has its own .h and .m file and from this file I want trigger a segue to a tableview controller.
-A `Tableviewcontroller` was added in xcode and a segue from the `UIviewController` to the `TableViewcontroller` was created as well (`Xcode`)

-created a protocol in the `UIView` to have the segue pushed from there.

PROBLEM:

delegate always nil, segue method will never be called

UIVIEW .h file

```
@protocol UItoUIvcDelegate <NSObject>

-(void)triggerSegue;

@end

@interface CFfirstGraph : UIView <CPTPlotDataSource , CPTPieChartDelegate,UIActionSheetDelegate>

@property(weak, nonatomic) id <UItoUIvcDelegate> delegate;

@end

```

UIVIEW .m file (snippet)

```
-(void)pieChart:(CPTPieChart *)pieChart sliceWasSelectedAtRecordIndex:(NSUInteger)index
 {

     if (self.delegate == nil)
     {
         NSLog(@"nil");
     }
     [self.delegate triggerSegue];
}

```

UIVIEWCONTROLLER .h file

```
#import "CFfirstGraph.h"

@interface CFMainViewController : UIViewController <UItoUIvcDelegate, UITableViewDelegate, UITableViewDataSource>

@end

```

UIVIEWCONTROLLER .m file (snippet)

```
- (void)viewDidLoad
{
    [super viewDidLoad];
    self.scrollView.contentSize = CGSizeMake(320, 1000);
    [self.view addSubview:self.scrollView];
    CFfirstGraph *click =[[CFfirstGraph alloc]init];
    click.delegate = self ;

}

-(void)triggerSegue

{
    [self performSegueWithIdentifier:@"detailedData" sender:self];
    NSLog(@"estoy aqui");
}

```

What am I doing wrong ? why the delegate is always nil ? I tried to add the method setDelegate but still no luck.

Thanks,
 dom