所以我想在向下滚动时隐藏导航栏并在向上滚动时将其拉回来.隐藏它完美地与
self.navigationController?.hidesBarsOnSwipe = true
Run Code Online (Sandbox Code Playgroud)
但我希望在向上滚动时再次显示它.我做了一个测试项目,其中视图控制器只有一个覆盖整个屏幕的UICollectionView.然后显示导航栏按预期再次显示,直到我将此行添加到viewDidLoad(将单元格添加到集合视图):
self.collectionView.delegate = self
Run Code Online (Sandbox Code Playgroud)
这就是整个视图控制器的样子
class ViewController: UIViewController,UICollectionViewDataSource, UICollectionViewDelegate {
@IBOutlet var collectionView: UICollectionView!
override func viewDidLoad() {
super.viewDidLoad()
self.collectionView.dataSource = self
self.collectionView.delegate = self
self.collectionView.registerClass(UICollectionViewCell.self, forCellWithReuseIdentifier: "Test")
self.navigationController?.hidesBarsOnSwipe = true
}
func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return 3
}
func numberOfSectionsInCollectionView(collectionView: UICollectionView) -> Int {
return 1
}
func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {
return collectionView.dequeueReusableCellWithReuseIdentifier("Test", forIndexPath: indexPath) as UICollectionViewCell
}
func collectionView(collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAtIndexPath …Run Code Online (Sandbox Code Playgroud) 我正在使用sbt-native-packager 1.0.0-M5来创建我的docker镜像.我需要添加一个不是源文件或资源文件夹的文件.我的docker命令如下:
dockerCommands := Seq(
Cmd("FROM", "myrepo/myImage:1.0.0"),
Cmd("COPY", "test.txt keys/"), // <-- The failing part
Cmd("WORKDIR", "/opt/docker"),
Cmd("RUN", "[\"chown\", \"-R\", \"daemon\", \".\"]"),
Cmd("USER", "daemon"),
ExecCmd("CMD", "echo", "Hello, World from Docker")
)
Run Code Online (Sandbox Code Playgroud)
它失败了: msg="test.txt: no such file or directory"
所以在挖了一下之后,似乎我需要test.txt进去target/docker/stage.然后它工作.但是我如何自动获得它呢?该文件实际上位于项目的根文件夹中.
对于某些视频,requestImageForAsset以UIImage为零完成.对于其他视频,它工作正常,我还没弄清楚为什么.
func createThumbnailForVideo(video: PHAsset) -> Future<NSURL> {
let promise = Promise<NSURL>()
let options = PHImageRequestOptions()
options.synchronous = true
imageManager.requestImageForAsset(video, targetSize: CGSizeMake(640, 640), contentMode: .AspectFill, options: options) { (image:UIImage!, info) -> Void in
if image == nil {
println("Error: Couldn't create thumbnail for video")
promise.error(MyErrors.videoThumb())
} else {
if let thumbURL = self.savePhotoAsTemporaryFile(image) {
promise.success(thumbURL)
} else {
promise.error(MyErrors.videoThumb())
}
}
}
return promise.future
}
Run Code Online (Sandbox Code Playgroud)
我也找回了请求的信息,但我不知道如何解释这些信息:
[PHImageResultIsDegradedKey: 0, PHImageResultWantedImageFormatKey: 4037, PHImageResultIsPlaceholderKey: 0, PHImageResultIsInCloudKey: 0, PHImageResultDeliveredImageFormatKey: 9999]
Run Code Online (Sandbox Code Playgroud) 我正在使用Slick 3.1.0-M2,我希望在我的表中使用java.time.LocalDate和java.time.LocalTime.我是这样做的:
import java.sql.{Date, Time, Timestamp}
import java.time.{LocalDate, LocalTime, LocalDateTime, ZoneOffset}
trait DateTimeColumns {
import slick.driver.PostgresDriver.api._
implicit val localDateTimeColumnType = MappedColumnType.base[LocalDateTime, Timestamp](
d => Timestamp.from(d.toInstant(ZoneOffset.ofHours(0))),
d => d.toLocalDateTime
)
implicit val dateColumnType = MappedColumnType.base[LocalDate, Date](
d => Date.valueOf(d),
d => d.toLocalDate
)
implicit val timeColumnType = MappedColumnType.base[LocalTime, Time](
localTime => Time.valueOf(localTime),
time => time.toLocalTime
)
}
Run Code Online (Sandbox Code Playgroud)
所以我有3个隐式映射,但只有第一个编译.java.sql.Date和java.sql.Time的编译失败了:
could not find implicit value for evidence parameter of type slick.driver.PostgresDriver.BaseColumnType[java.sql.Date]
Run Code Online (Sandbox Code Playgroud)
当我在IntelliJ中进行隐式参数检查时,我可以看到第一个映射在文件JdbcTypesComponent.scala中找到TimestampJdbcType.紧挨着我,我看到了TimeJdbcType和DateJdbcType.那么为什么第一个被发现但其他人不是?