Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/44.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
Iphone 将UISegmentControl selectedSegmentIndex传递给Popover_Iphone - Fatal编程技术网

Iphone 将UISegmentControl selectedSegmentIndex传递给Popover

Iphone 将UISegmentControl selectedSegmentIndex传递给Popover,iphone,Iphone,对不起,我的问题是noob。我有一个视图在UIToolBar中有一个UISegmentControl。我还用一个按钮展示了一件府绸。如何将UISegmentControl的值获取到popover?我应该让Popover有一个NSInteger ivar来保存这个值吗?所以当我呈现Popover时,我将该值设置为selectedSegmentIndex是什么?我不知道这是否是最干净的方式,因为我是新手,一直在阅读关于不耦合类的内容。谢谢 我认为,您可以使用UISegmentControl的UICo

对不起,我的问题是noob。我有一个视图在UIToolBar中有一个UISegmentControl。我还用一个按钮展示了一件府绸。如何将UISegmentControl的值获取到popover?我应该让Popover有一个NSInteger ivar来保存这个值吗?所以当我呈现Popover时,我将该值设置为selectedSegmentIndex是什么?我不知道这是否是最干净的方式,因为我是新手,一直在阅读关于不耦合类的内容。谢谢

我认为,您可以使用
UISegmentControl
UIControlEventValueChanged
事件直接将popover的标记属性设置为
UISegmentControl
selectedSegmentIndex

{
[segmentedControl addTarget:self
                     action:@selector(setvalueofselected:)
           forControlEvents:UIControlEventValueChanged];
}

-(IBAction)setvalueofselected:(id)sender
{
  popover.tag = segmentedControl.selectedSegmentIndex;

OR

   self.intSelected = segmentedControl.selectedSegmentIndex;
}
从弹出窗口中单击事件代码,尝试检查标记的属性。您也可以使用一些全局整数来代替标记属性

通过这种方式,您的POPOver可以知道在单击POPOver时选择了哪个片段