Swift到Objective-C语法

Swift到Objective-C语法,objective-c,Objective C,有人能帮我把这行代码转换成Objective-C吗?它是用Swift写的,我对语法不太熟悉 searchController = UISearchController(searchResultsController: nil) searchController.hidesNavigationBarDuringPresentation = false self.searchController.searchBar.delegate = self presentViewController(sear

有人能帮我把这行代码转换成Objective-C吗?它是用Swift写的,我对语法不太熟悉

searchController = UISearchController(searchResultsController: nil)
searchController.hidesNavigationBarDuringPresentation = false
self.searchController.searchBar.delegate = self
presentViewController(searchController, animated: true, completion: nil)

如果self是UIViewController

[self presentViewController:searchController animated:YES completion:nil];

最好使用
nil
而不是
NULL
我感谢您的建议!我用几行代码更新了这个问题。你能帮我一下吗?@AlexBlair,属性的设置方式是一样的,只是
false
将是
NO
。UIVIewController的实例化将使用通用或自定义的init方法
UISearchController*searchController=[[UISearchController alloc]init]
那么,你知道苹果的官方文档中有Swift&Objective-C语法,在他们的库中,所有可用的东西都是并排显示的,对吧?我想可能是这样的,但我是Bloc的一名新生,我发现了这段代码,这是我正在进行的项目绝对需要的。一旦我了解了objective-c的来龙去脉,我计划潜入swift。我并不是有意的,我只是需要尽快翻译一段特定的代码。堆栈溢出不是这样工作的。
[self presentViewController:searchController animated:YES completion:nil];