English 中文(简体)
代表行动
原标题:Delegate Action Never Gets Called

当我试图在我的行程观点被否定时,将可调用的口号中的数据重新上载时,我会遇到使用议定书/立法的麻烦。

这里是我的“模式观点”文件中的一些法典:

@protocol LoginWebViewDelegate <NSObject>
     -(void) updateFromModalView;
@end

@interface myModalView : UIViewController{
    id<LoginWebViewDelegate> loginDelegate; 
    ..
}
@property (nonatomic, assign) id<LoginWebViewDelegate> loginDelegate;
..
-(IBAction)dismiss;
..

在我的档案中,我综合了日志;我执行了辞退行动与计划;当我向纽特报时,它已经启动。

-(IBAction) dismiss
{
    NSLog(@"Button Pressed!");
    [loginDelegate updateFromModalView];
}

紧接着我方言中的话 我添加了<代码><LoginWebViewDelegate> &此处为我执行的行动:

-(void) updateFromModalView
{
    [modalView dismissModalViewControllerAnimated:YES];
    NSLog(@"Reloading Data");
    [dataController readPlist];
    [dataTable reloadData];
    [dataTable beginUpdates];
    [dataTable deleteSections:[NSIndexSet indexSetWithIndex:0] withRowAnimation:YES];
    [dataTable insertSections:[NSIndexSet indexSetWithIndex:0] withRowAnimation:YES];
    [dataTable endUpdates];
}

The method updateFromModalView never gets called. What do I miss?

最佳回答

You are missing (or you haven t posted) the part where you assign a value to loginDelegate. You mention synthesising it but that only creates accessor methods, it doesn t set a value.

在你们的法典中,你需要这样的发言:

self.loginDelegate = _something_;

或者,无论出于何种目的,这种观点的控制者在创建该代表之后,但在提出该代表之前,会把自己或另一个目标作为代表:

modalController = [[ModalController alloc] initWithNibName:@"ModalController];
modalController.loginDelegate = self;
[self presentModalViewController:modalController];
问题回答

暂无回答




相关问题
Code sign Error

I have created a new iPhone application.I have two mach machines. I have created the certificate for running application in iPhone in one mac. Can I use the other mac for running the application in ...

ABPersonViewController Usage for displaying contact

Created a View based Project and added a contact to the AddressBook using ABAddressBookRef,ABRecordRef now i wanted to display the added contact ABPersonViewController is the method but how to use in ...

将音频Clips从Peter改为服务器

我不禁要问,那里是否有任何实例表明从Peit向服务器发送音响。 I m不关心电话或SIP风格的解决办法,只是一个简单的袖珍流程......

• 如何将搜查线重新定位?

我正试图把图像放在搜索条左边。 但是,问题始于这里,搜索条线不能重新布署。

热门标签