我正在尝试使用UISearchController为我的iphone应用程序显示一个简单的搜索屏幕.我使用了UITableViewController和UISearchController,它嵌入在UINavigationController中


我想做的是直接获得状态2而不进入状态1
我试图添加此代码
presentViewController(searchController, animated: true, completion: nil)
Run Code Online (Sandbox Code Playgroud)
但它要么不显示搜索栏,如果动画是假的,或者显示它我想要但是在不必要的过渡后暂时显示导航栏
我正在尝试创建一个String扩展来执行类似的操作
"My name is %@. I am %d years old".localizeWithFormat("John", 30)
Run Code Online (Sandbox Code Playgroud)
看起来像这样
extension String {
func localizeWithFormat(arguments: CVarArgType...) -> String {
return String.localizedStringWithFormat(
NSLocalizedString(self,
comment: ""), getVaList(arguments))
}
}
Run Code Online (Sandbox Code Playgroud)
它给我以下编译错误
类型CVaListPointer不符合协议CVargType
任何人都知道如何解决这个编译错误?
我试图在框内垂直居中一些符号.但我不能让符号在OSX和windows中垂直对齐
这是一个非常简单的例子,我用来演示 http://dabblet.com/gist/2971548
您会注意到x在窗口中垂直居中,但在OS X上没有.如何解决此问题?