Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Cocoa touch 从其他ViewController获取按钮标签的值_Cocoa Touch_Nsstring_Uipopovercontroller - Fatal编程技术网

Cocoa touch 从其他ViewController获取按钮标签的值

Cocoa touch 从其他ViewController获取按钮标签的值,cocoa-touch,nsstring,uipopovercontroller,Cocoa Touch,Nsstring,Uipopovercontroller,这似乎很琐碎,但不知何故,我无法让它工作。我有两个带有tableView作为内容的Popover控制器,还有一个带有一些按钮的UIViewController。 我正在从PopoverController的DidSelectRoxatineXpath函数中设置一个按钮标题。这很有效。现在我想把这个按钮标题传递给第二个PopoverController,但似乎无法让它工作;该字符串返回空值。目前我正在使用: h文件: NSString *myString; @property(nonatomic,

这似乎很琐碎,但不知何故,我无法让它工作。我有两个带有tableView作为内容的Popover控制器,还有一个带有一些按钮的UIViewController。 我正在从PopoverController的DidSelectRoxatineXpath函数中设置一个按钮标题。这很有效。现在我想把这个按钮标题传递给第二个PopoverController,但似乎无法让它工作;该字符串返回空值。目前我正在使用:

h文件:

NSString *myString;
@property(nonatomic,retain)NSString *myString;
m文件:

@synthesize myString;
在viewDidLoad中:

MyAppViewController *appV = [[MyAppViewController alloc]initWithNibName:@"MyAppViewController" bundle:nil];
self.myString = appV.buttonOne.currenTitle;

在显示第二个
UIPopoverController

之前,请尝试设置此属性。至少在我显示UIPopoverController之前,该值似乎很好,之后设置为NULL。上面的代码是来自第二个视图控制器吗?是的。虽然现在我将其放在加载第二个uipopover的主视图控制器部分。还是不行。奇怪的是,字符串值似乎被传递到了popover上,而我用这个键保存从plist文件中获取的项目的数组就在那里,它们只是没有以某种方式显示出来。为什么不尝试使用委托变量呢?我的意思是在委托变量中存储一个字符串,并在不同的视图中使用它。听起来不错,但我到底如何做到这一点呢?:)对所有这些仍然有点陌生,即使这听起来很琐碎,如果可能的话,我还是非常感谢一个小的代码示例。