我的场景,我试图从UINavigationBar
使用iOS 13 - Swift 5 中删除底线和阴影。在这里,在iOS 13 - Swift 5之前,我使用下面的代码在不改变导航栏颜色的情况下去除底线和阴影。现在,它没有显示NavigationBar
颜色(我已经设置了条形颜色和背景颜色)也禁用了半透明。
代码:
UINavigationBar.appearance().shadowImage = UIImage()
UINavigationBar.appearance().setBackgroundImage(UIImage(), for: .default)
Run Code Online (Sandbox Code Playgroud)
如何解决这个问题?需要去除底线阴影,还想给 NavigationBar 颜色。
我的场景是,我尝试根据选择实现UICollectionView
水平第一个和最后一个单元格中心对齐。scrollview
在这里,第一次第CollectionViewCell
一个单元格没有显示确切的中心位置。如果我didselect
一次一切正常。 \n我需要修复应用程序第一次打开第一个单元格时不显示确切的中心位置。
注意:我没有\xe2\x80\x99t添加页眉和页脚,我也使用故事板完成了设计。
\n\nfunc collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {\n let text = self.items[indexPath.row]\n let cellWidth = text.size(withAttributes:[.font: UIFont.systemFont(ofSize: 14.0)]).width + 10.0\n return CGSize(width: cellWidth, height: collectionView.bounds.height)\n }\n\n func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, insetForSectionAt section: Int) -> UIEdgeInsets {\n let inset: CGFloat = collectionView.frame.width * 0.5 - 52 * 0.5\n return UIEdgeInsets(top: 0, left: inset, bottom: 0, right: inset)\n }\n
Run Code Online (Sandbox Code Playgroud)\n 我的场景,我正在尝试使用文档文件夹路径从特定文档目录中删除所有文件。在这里,每次我在我的应用程序文档目录文件夹中保存文件时,通过使用下面的代码,我无法删除文件
let urlString: String = myurl.absoluteString
print("FILEURL:\(urlString)")
do {
try fm.removeItem(atPath: "\(myurl)")
} catch let error as NSError {
print(error.debugDescription)
}
Run Code Online (Sandbox Code Playgroud)