我想从另一个viewcontroller(我正在PSStackedViewExample https://github.com/steipete/PSStackedView工作)重新加载tableview。我的UIViewController在哪里做修改是有点在我的UITableViewController上,我正在对当前在我的TableView上的数据进行更改,这就是为什么我想重新加载tableview直接看到更改,当我修改UIViewController上的东西。如何从另一个UIViewController重新加载UITableViewController
我无法访问它...每当我发疯时,你能帮助我吗?
对PSStackedViewExample项目,我说的UITableViewController是ExampleViewController2。 我谈论的是的UIViewController:ExampleViewController1
这里是在情况下,代码的一些你所不立即下载项目:
ExampleMenuRootController这是主控制器,它调用的UITableViewController
的.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
所述的.m - >
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
PSStackedViewController *stackController = XAppDelegate.stackController;
viewController = nil;
[sObjDataForRootVC.tmpGuest removeAllObjects];
[self checkDictionnaryForIndexPath:@"0"];
[self checkDictionnaryForIndexPath:@"1"];
[self checkDictionnaryForIndexPath:@"2"];
if (indexPath.row > 0 && indexPath.row < 4)
{
[sObjDataForRootVC.tmpGuest removeAllObjects];
[self checkDictionnaryForIndexPath:[NSString stringWithFormat:@"%i", indexPath.row - 1]];
}
if (indexPath.row > 3 && indexPath.row < 8)
{
[sObjDataForRootVC.tmpGuest removeAllObjects];
[self checkDictionnaryForIndexPathForFunction];
}
while ([stackController.viewControllers count]) {
[stackController popViewControllerAnimated:YES];
}
// HERE I CALL THE UITABLEVIEWCONTROLLER !!!
viewController = [[ExampleViewController2 alloc] initWithStyle:UITableViewStylePlain];
((ExampleViewController2 *)viewController).indexNumber = [stackController.viewControllers count];
if (viewController) {
[XAppDelegate.stackController pushViewController:viewController fromViewController:nil animated:YES];
}
}
然后在下面,UIViewController的.h将修改UITableView。我需要做一个reloadData上实现代码如下从以前的UITableViewController
#include "PSStackedViewDelegate.h"
#import "AppDelegate.h"
@interface ExampleViewController1 : UIViewController <PSStackedViewDelegate, UITextFieldDelegate>
{
IBOutlet UIButton *validateBtn;
IBOutlet UIButton *cancelBtn;
singleObjGetData *sObjDataForRootVC;
}
的.M
#import "ExampleViewController1.h"
#import "ExampleViewController2.h"
#import "ExampleMenuRootController.h"
#import "PSStackedView.h"
@implementation ExampleViewController1
#pragma mark - View lifecycle
- (void)viewDidLoad {
sObjDataForRootVC = [singleObjGetData singleObj];
confirmPressed = NO;
[self setUpView];
[super viewDidLoad];
self.view.width = PSIsIpad() ? 400 : 150;
}
感谢很多的帮助...
而不是添加的代码块(人们可以从链接代码),加上一些截图这将阐述什么其实你的问题是 –
我现在无法访问ftp服务器,我不能对不起 – xGoPox