Objective c 如何从另一个UIViewController重新加载UITableViewController
我想从另一个viewcontroller重新加载tableview(我正在处理PSStackedViewExample)。我修改的UIViewController是在UITableViewController上进行的,我正在对当前TableView上的数据进行更改,这就是为什么我希望在修改UIViewController上的某些内容时重新加载TableView以直接查看更改的原因 我无法接近它。。。每次我为这个发疯,你能帮我吗 在PSStackedViewExample项目中,我谈论的UITableViewController是ExampleViewController2。 我谈论的UIViewController是:ExampleViewController1 以下是一些代码片段,以防您不支持该项目: ExampleMenuRootController是主控制器,它调用UITableViewControllerObjective c 如何从另一个UIViewController重新加载UITableViewController,objective-c,ios,tableview,viewcontroller,Objective C,Ios,Tableview,Viewcontroller,我想从另一个viewcontroller重新加载tableview(我正在处理PSStackedViewExample)。我修改的UIViewController是在UITableViewController上进行的,我正在对当前TableView上的数据进行更改,这就是为什么我希望在修改UIViewController上的某些内容时重新加载TableView以直接查看更改的原因 我无法接近它。。。每次我为这个发疯,你能帮我吗 在PSStackedViewExample项目中,我谈论的UITab
#include "PSStackedViewDelegate.h"
#import "AppDelegate.h"
@interface ExampleViewController1 : UIViewController <PSStackedViewDelegate, UITextFieldDelegate>
{
IBOutlet UIButton *validateBtn;
IBOutlet UIButton *cancelBtn;
singleObjGetData *sObjDataForRootVC;
}
首先是.h->
#import <UIKit/UIKit.h>
#import "Guest.h"
@interface ExampleMenuRootController : UIViewController <UITableViewDataSource, UITableViewDelegate> {
UITableView *menuTable_;
NSArray *cellContents_;
singleObjGetData * sObjDataForRootVC;
UIViewController *viewController;
}
@property (nonatomic, retain) UIViewController *viewController;
@property (nonatomic,strong) NSManagedObjectContext* managedObjectContext;
- (void)checkDictionnaryForIndexPathForFunction;
-(IBAction)showTable:(id)sender;
- (void)checkDictionnaryForIndexPath:(NSString *)check;
@end
非常感谢你的帮助 您可以通过在第二个tableview中设置一个通知来实现这一点,该通知调用第一个tableview上的重载数据。将其放在第二个tableView中:
[[NSNotificationCenter defaultCenter]
postNotificationName:@"refreshData"
object:nil
userInfo:nil//userInfoDictionary
];
在您的第一个tableView中,输入以下内容:
[[NSNotificationCenter defaultCenter]
addObserver:self
selector:@selector(methodToRefreshYourFirstTable)
name:@"refreshData"
object:nil];
不要添加代码块(人们可以从链接下载代码),而是添加一些屏幕截图,详细说明你的问题,我现在无法访问ftp服务器,我不能道歉
[[NSNotificationCenter defaultCenter]
postNotificationName:@"refreshData"
object:nil
userInfo:nil//userInfoDictionary
];
[[NSNotificationCenter defaultCenter]
addObserver:self
selector:@selector(methodToRefreshYourFirstTable)
name:@"refreshData"
object:nil];