Tab Order in interface builder?

旧时模样 提交于 2019-11-27 15:43:45

问题


Perhaps the hour is late, but I can't find where I can set the overall Tab Order of my interface viewer dialog, just like I can with Visual Studio.

am I missing something? The tab order is all crooked. Command-R to simulate shows it.


回答1:


The Cocoa term you're looking for is "key view loop". Use the initialFirstResponder and nextKeyView outlets to connect the views together in the order you'd like to tab through them.

This is mentioned in the documentation here.

Note that the items which can receive keyboard focus will change depending on the Full Keyboard Access setting (in System Preferences > Keyboard); if disabled, tabbing will skip over various items in your key view loop.




回答2:


Let the outlets are named as a, b and c. Mac default tab order is a -> b -> c -> a

But Your desired tab order is a -> c -> b ->a :

Using IB:

Set a as the initialFirstResponder.

Then put the nextKeyView accordingly as a to c, c to b and c to a.

But I prefer using codes, here it become easier to add more. As in complex UI there may be 30+ controls and you might require to shuffle and even insert new control!!!

So you can achieve the same as :

[self.a setNextKeyView:self.c];
[self.c setNextKeyView:self.b];
[self.b setNextKeyView:self.a];



回答3:


I have found that placing the group of textfields in a separate view will help control the order in which the elements get their focus.

I tested in the simulator and on an iPad. It worked well for me.



来源:https://stackoverflow.com/questions/4261865/tab-order-in-interface-builder

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!