小编Pie*_*rre的帖子

IOS8 UISearchController直接显示搜索栏

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

  • 这让我看到以下屏幕(状态1)

带导航栏的searchcontroller

  • 当用户点击搜索字段时,我会看到下面的屏幕(状态2):搜索栏在状态栏下方的屏幕顶部显示.

searchcontroller已激活

我想做的是直接获得状态2而不进入状态1

我试图添加此代码

presentViewController(searchController, animated: true, completion: nil)
Run Code Online (Sandbox Code Playgroud)

但它要么不显示搜索栏,如果动画是假的,或者显示它我想要但是在不必要的过渡后暂时显示导航栏

uinavigationcontroller ios uisearchcontroller

3
推荐指数
1
解决办法
2560
查看次数

Swift中的localizeWithFormat和variadic参数

我正在尝试创建一个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

任何人都知道如何解决这个编译错误?

localization swift

3
推荐指数
1
解决办法
1793
查看次数

垂直对齐文本mac和PC

我试图在框内垂直居中一些符号.但我不能让符号在OSX和windows中垂直对齐

这是一个非常简单的例子,我用来演示 http://dabblet.com/gist/2971548

您会注意到x在窗口中垂直居中,但在OS X上没有.如何解决此问题?

css fonts

2
推荐指数
1
解决办法
2116
查看次数