iPad popover-如何在分段控件中指向一个分段? [英] iPad popover - How do you point to one segment in a segmented control?

查看:92
本文介绍了iPad popover-如何在分段控件中指向一个分段?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个iPad弹出窗口,想在分段控件中显示(指向)一个分段.下面的代码工作正常,只不过指针指向分段控件的中间-我希望它指向正确的分段.即细分0或细分1.

I have an iPad popover and would like to present (point) to one segment in a segmented control. The code below works fine except the pointer points to the middle of the segmented control - I would prefer it points to the correct segment. ie segment 0 or segment 1.

if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
   [printController presentFromBarButtonItem:self.navigationItem.rightBarButtonItem animated:YES completionHandler:completionHandler];// iPad
}

非常感谢.

推荐答案

下面的代码对于将弹出框指向段控件中选定的选项卡可能有用.

Code below may be useful for pointing popover to selected tab in segment control.

CGRect frame = [segmentControl frame];
frame =CGRectMake((frame.size.width/No. of segments * [segmentControl selectedSegmentIndex]), 0, frame.size.width/No. of segments, segmentControl.bounds.size.height);

[m_PopOver presentPopoverFromRect:frame inView:segmentControl permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];

这篇关于iPad popover-如何在分段控件中指向一个分段?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆