0

我有一个视图控制器,它有一个动作来呈现一个视图控制器

GoodNewsBodyViewController.h

@interface GoodNewsBodyViewController : UIViewController<EventListDelegate>

GoodNewsBodyViewController.m

-(IBAction)goToEvents:(id)sender {
                EventTableViewController* eventsController = [[EventTableViewController alloc] initWithNibName:@"EventTableViewController" bundle:nil];

        [eventsController setListOfEvents:goodNews.Events];
        //try both ways
        [eventsController setDelegate:self];
        eventsController.delegate = self;

        [self presentModalViewController:eventsController animated:YES];
    }
    - (void)loginFormDidFinish:(EventTableViewController*)loginForm {
        // do whatever, then
        // hide the modal view


        EventViewController *eventController = [[EventViewController alloc] initWithNibName:@"EventViewController" bundle:nil];
        [eventController setEvent:loginForm.event];
        [self.navigationController pushViewController:eventController animated:YES];
        // clean up
        [self dismissModalViewControllerAnimated:YES];
    }

EventTableViewController.h

@class EventTableViewController;

@protocol EventListDelegate
- (void)loginFormDidFinish:(EventTableViewController*)loginForm;
@end
@interface EventTableViewController : UIViewController <RKObjectLoaderDelegate, UITableViewDataSource, UITableViewDelegate> {
    id<EventListDelegate> delegate;
    NSArray* eventList;
    Organisation* organisation; 
    IBOutlet UITableView* _tableView; 
    NSMutableArray* listOfEvents;
    Event* event;

}
@property (strong) id<EventListDelegate> delegate;
@property (nonatomic, strong) IBOutlet UITableView* _tableView; 
@property (nonatomic, strong) NSArray* eventList;
@property (nonatomic, strong) Organisation* organisation; 
@property (nonatomic, strong) NSMutableArray* listOfEvents;
@property (nonatomic, strong) Event* event;

当在 eventstableviewcontroller 中选择一个事件时,我希望将该事件回发。我试图通过将事件作为在 eventstableviewcontroller 的 didselect 方法中设置的属性来做到这一点。The events list is being presented and when an event is selected it, the list disapears. 这都是正确的,但 - (void)loginFormDidFinish:(EventTableViewController*)loginForm;

事件似乎没有触发,我在那里设置了断点,但它们永远不会被击中......感谢任何帮助!

4

1 回答 1

0

你的loginFormDidFinish:方法应该是这样的

-

(void)loginFormDidFinish:(EventTableViewController*)loginForm {
        // hide the modal view
        [self dismissModalViewControllerAnimated:NO];//without animation


        EventViewController *eventController = [[EventViewController alloc] initWithNibName:@"EventViewController" bundle:nil];
        [eventController setEvent:loginForm.event];
        [self.navigationController pushViewController:eventController animated:YES];
        [eventController release];
        // clean up
}
于 2012-09-21T12:49:33.523 回答