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