I'm sitting with a issue which I can't solve in a while. I must be doing something very wrong.
I have 2 views, a UIView
and UITableView
. They're embedded with a NavigationController
.
In the second view; TableView
, I want to pass a NSInteger
back to the UIView, the first view.
I've used the solution of https://stackoverflow.com/a/19343715/3355194 but didn't work for me. It gives me a 0 value back in the UIView. In the TableView it does give me right value of numberOnSectionInTableView
.
Also tried some other solution but same result.
What I did so far.
In the TableView.h
:
@protocol senddataProtocol <NSObject>
-(void)sendBadgeIntBack:(int*)section;
@property (nonatomic, assign) id delegate;
TableView.m
:
@synthesize delegate;
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
self.section = [self.tableView numberOfSections];
section = [[[UIApplication sharedApplication] scheduledLocalNotifications] count];
NSLog(@"Number of sections: %i", section-1);
return (int)[[[UIApplication sharedApplication] scheduledLocalNotifications] count]/2;
}
-(void)viewWillDisappear:(BOOL)animated
{
[delegate sendBadgeIntBack:&(section)];
}
UIView.h
:
@property (nonatomic) int section;
UIView.m
:
It gives me a 0 value here.
-(void)sendBadgeIntBack:(int*)section
{
NSLog(@"The numbers of sections in tableView are: %i", self.section);
}
Hope you could help me find the solution. Thank you in advance.