我正在努力实现https://stackoverflow.com/a/17376619/433570
特别是
getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR);
我见过NSDictionaryOfVariableBindings swift equivalent?
但它对我没有多大帮助,我怎样才能将objc翻译成swift?
答案 0 :(得分:1)
您只需获取NSDictionaryOfVariableBindings
中列出的每个视图,并创建一个包含此视图的常用快速字典,并将变量名称作为键。
示例:
NSDictionaryOfVariableBindings(view1, view2, view3)
将成为
["view1" : view1, "view2" : view2, "view3" : view3]
所以
NSDictionary *views = NSDictionaryOfVariableBindings(subview);
将成为
let views = ["subview" : subview]