草庐IT

selectedIndexes

全部标签

ios - self.navigationController.tabBarController.selectedIndex 不工作

我有一个UITabBarController,它包含4个不同的UIViewControllers。在第一个选项卡上有一个UINavigationViewController,它包含它的子UIViewController。在不点击标签栏的情况下,我想将用户带到第二个标签上。为此,我尝试了:self.navigationController.tabBarController.selectedIndex=1;但它不起作用。忽略任何错误,我是新手。谢谢。 最佳答案 如果设置委托(delegate)试试这个:self.selectedInde

iphone - UITabBarController.selectedIndex 不改变tabBar图标?

在我的应用程序中使用UITabBarController时,我无法选择TabBar中的第一项(即蓝色)。它只是保持黑色和灰色。是否有另一种方法可以激活TabBar中的某个项目?我正在使用:self.tabController.selectedIndex=0;(感兴趣的是,这一切都在AppDelegate中实例化,因为委托(delegate)正在处理一个欢迎View)一旦被取消,它就会从屏幕上移除,UITabController.view将接管。更新:在MainAppDelegate中,我使用这段代码来显示tabController并设置索引:#pragmamark-Clickhandl

ios - 如何在 iOS 中为 UITabBarController 的更多 View Controller 设置 selectedindex

如何将setSelectedIndex设置为UITabBarController以显示存在于MoreView中的ViewController。我尝试使用以下代码设置索引//ToredirectusertohomescreenTBDDashboardTabBarController*tabBar=segue.destinationViewController;[tabBarsetSelectedIndex:5];但由于iOS最多只能显示5个标签,并且索引超出可见标签,因此索引ViewController未显示。如果我将setSelectedIndex设置为0到3,如[tabBarsetS

ios - tabBarController 为零;无法更改 viewDidLoad 上的 selectedIndex

我有一个像这样的UITabBarController:/*SomeTabBarController.h*/@interfaceSomeTabBarController:UITabBarController@end在SomeTabBarController.m中,我想更改viewDidLoad上的事件选项卡-(void)viewDidLoad{[superviewDidLoad];self.tabBarController.selectedIndex=2;}但是,tabBarController是nil。我错过了什么?我有一个导航Controller和segue推送到标签栏Control

Swift 2.1- tabBarController!.selectedIndex 返回大量整数

我需要将tabBarController!.selectedIndex数字放在常量中。根据我选择的选项卡,我希望得到一个介于0和3之间的数字,但我却得到了像2147483647这样的数字知道这是为什么吗?代码是:letselectedTab=tabBarController!.selectedIndexprint(selectedTab) 最佳答案 那个值是NSNotFound。在这种情况下,它似乎代表“没有选择”。 关于Swift2.1-tabBarController!.select

ios - TabBarController 上的动画过渡?.selectedIndex 更改? ( swift )

是否可以在swift中创建自定义tabBarController类以动画化选项卡之间的编程和交互式转换? 最佳答案 你可以试试这个在tabbarselecetion上的过渡动画functabBarController(_tabBarController:UITabBarController,shouldSelectviewController:UIViewController)->Bool{guardletfromView=selectedViewController?.view,lettoView=viewController.v

javascript - 更改 <option> 的 .html() 会将 <option> 的 selectedIndex 属性从 '-1' 重置为 '0'

更改时使用jQuery.html()的在里面(我之前将selectedIndex属性设置为-1)重置selectedIndex的属性(property)来自'-1'到'0'JSBin(01)(02)(03)$(".drpmnu").prop('selectedIndex',-1)$('#three').html("moo")http://jsbin.com/filowe/2/edit?html,output 最佳答案 此案例在HTML5spec中提到:Onsetting,theselectedIndexattributemustse

javascript - 如何使用显示文本设置选择元素的 selectedIndex?

如何设置以显示文本为引用的select元素的selectedIndex?例子:ChickenCrocodileMonkeyfunctionSelectAnimal(){//SetselectedoptionofAnimalsbasedonAnimalToFindvalue...}有没有其他方法可以不用循环来做到这一点?你知道,我正在考虑内置的JavaScript代码或其他东西。另外,我不使用jQuery... 最佳答案 试试这个:functionSelectAnimal(){varsel=document.getElementByI

关于c#:从另一个表单设置combobox selectedindex时出现问题

Troublesettingcomboboxselectedindexfromanotherform我正在尝试根据用户在第一个表单(form1)上选择的索引在另一个表单(form2)上设置selectedindex。我正在使用此代码获取值,但它返回一个负数。1234publicintSelectedComboIndex{  get{returncomboBox1.SelectedIndex;}}我正在尝试通过设置组合框索引1comboBox1.SelectedIndex=form1.SelectedComboIndex;谁能指出我正确的方向如何做到这一点?编辑:更多代码用于调用form1上的代

关于c#:从另一个表单设置combobox selectedindex时出现问题

Troublesettingcomboboxselectedindexfromanotherform我正在尝试根据用户在第一个表单(form1)上选择的索引在另一个表单(form2)上设置selectedindex。我正在使用此代码获取值,但它返回一个负数。1234publicintSelectedComboIndex{  get{returncomboBox1.SelectedIndex;}}我正在尝试通过设置组合框索引1comboBox1.SelectedIndex=form1.SelectedComboIndex;谁能指出我正确的方向如何做到这一点?编辑:更多代码用于调用form1上的代