我有两个类,class A
包含容器,UISegmentControl
位于class B
我有一个UITableView
,它嵌入了容器。
最初在加载数据时UITableView
正在加载UISegmentControl
我在class B
中重新加载时,@implementation UpgradeVCViewController
int flag = nil;
- (void)viewDidLoad {
[super viewDidLoad];
_containerView.alpha = 1.0;
// Do any additional setup after loading the view.
HHSlideView * slideView = [[HHSlideView alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height -64) ];
slideView.delegate = self;
[_iconView addSubview:slideView];
[self.view addSubview:_containerView];
-(NSInteger)numberOfSlideItemsInSlideView:(HHSlideView *)slideView
{
return 3;
}
-(NSArray *)namesOfSlideItemsInSlideView:(HHSlideView *)slideView
{
NSArray *items = [[NSArray alloc]initWithObjects:@"PREMIUM ECONOMY",@"BUSINESS",@"FIRST", nil];
return items;
正在加载,因为没有进行表重新加载!
带有容器的A类
- (void)slideView:(HHSlideView *)slideView didSelectItemAtIndex:(NSInteger)index {
NSLog(@" index %li", index);
flag = index ;
if(flag == 1 || flag == 2)
{
SampleTableViewController * obj = [[SampleTableViewController alloc]init];
[obj.reloadtable reloadData];
}
}
}
-(void)sampleMethod
{
[self.reloadtable reloadData];
}
B类
NoRecovery
答案 0 :(得分:-1)
您需要在containerView(B类)中使用NSNotificationCentre重新加载tablview。
添加
[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(reloadTablViewWithNotification:) name:@"reloadTableView" object:nil];
-(void)reloadTablViewWithNotification:(NSNotification *)notification{
NSLog(@"%@",[notification object]); // prints "Your object"
// here you can reload your tableview
}
//在您需要时发布
[[NSNotificationCenter defaultCenter]postNotificationName:@"reloadTableView" object:@"Your object"];