2016-02-13 57 views

回答

0

在SecondViewController: - 在textFieldDidEndEditing

[itemDict setObject:[NSString stringWithFormat:@"%@",eventTitleTextField.text] forKey:@"itemTitle"]; 
[[NSNotificationCenter defaultCenter]postNotificationName:@"callViewController" object:nil userInfo:itemDict ]; 

在FirstViewController: - viewDidLoad中

[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(callViewController:) name:@"callViewController" object:nil]; 

然后

-(void)callViewController:(NSNotification *)notification 
{ 
NSString *check=[NSString stringWithFormat:@"%@",[notification.userInfo objectForKey:@"itemTitle"]; 

} 
if ([check isEqualToString:@""]) { 

    /// do 

}else{ 
    // do 
} 
0

的钱德里卡·请检查你的代码像下面

创建全局变量NSObject类。 然后申报

​​

接着合成该串中.m文件

@synthesis strTextfieldValue; 

然后创建在NSObject类类方法最终启动该方法中的字符串。

在第二个视图中调用或导入NSObject类.h。控制器。

为NSObject类创建对象并启动该方法。

globalclass.strTextfieldValue=textfieldName.text; 

,然后导入您SecondViewController.h并在FirstViewController.h

导入NSObject的class.h最后检查字符串是否为零或不在按钮操作方法。

相关问题