나는 잠시 후에 풀 수없는 문제에 관해 생각하고있다. 나는 아주 잘못된 것을해야 할 것입니다. 조회수는 UIView
이고 UITableView
입니다. 그것들은 NavigationController
으로 내장되어 있습니다.NavigationController에서 int 전달하기
두 번째보기에서; TableView
, NSInteger
을 첫 번째보기 인 UIView로 다시 전달하고 싶습니다.
나는 https://stackoverflow.com/a/19343715/3355194의 솔루션을 사용했지만 나에게 도움이되지 못했습니다. 그것은 나에게 0 값을 다시 UIView에서 제공합니다. TableView에서 그것은 바로 값 numberOnSectionInTableView
을 제공합니다. 다른 해결책을 시도했지만 동일한 결과가 나타납니다.
지금까지 내가 한 것. 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
: 그것은 나에게 여기에 0 값을 제공합니다.
-(void)sendBadgeIntBack:(int*)section
{
NSLog(@"The numbers of sections in tableView are: %i", self.section);
}
당신이 해결책을 찾도록 도울 수 있기를 바랍니다. 미리 감사드립니다.
Obj-c를 처음 사용하는 사람에게 감사의 말을 전합니다. 나는 그것이 어리석은 실수라는 것을 알았다. – SwingerDinger
Np, 앞으로의 노력에 행운을 빕니다! – Adis