我升级Xcode 7.3
到Xcode 8.0
并更改了语法swift 2.3 to swift 3.0
.我能够构建项目并且运行良好,但我收到了大约233个关于我用过的图像的警告Assets.xcassets.
我意识到路径是错误的,因为我更改了项目的名称,projectA to projectB
路径指的是无效路径
/Users/name/Desktop/projectA/projectB/Assets.xcassets/Images/img_01.imageset/img_01@2x.png is missing from working copy
Run Code Online (Sandbox Code Playgroud)
我相信我必须删除这些文件的名称,sourcecontrol
因为它们不再有效.我已经提交了所有更改,并且不知道如何删除这些丢失的文件链接以消除这些警告.
我正在开发一个使用核心数据的应用程序,因为我认为我可以使用iCloud核心数据提供的同步功能在iPad和iPhone之间同步数据,现在它已被弃用.
我遇到了CloudKit,但主要是创建和管理最终用户社区可以使用的数据,而不仅仅是聊天应用程序之类的数据.我的应用仅适用于单个用户,因此用户可以在他们的Apple eco系统设备之间同步他们的数据.
我是iOS开发的新手,因此了解哪种技术符合我的要求会很有帮助.
简而言之,您能否建议我应该使用什么
PS你能否在保存数据的同时建议一些不需要用户登录iCloud的东西.
我有一个图像的细胞viewController
,我想给用户一个选项来选择的一个image
为他们title label
.如何让他们只选择一个image
,即如果他们选择另一个image
我想取消选择image
他们之前选择的.
这就是我做的:
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
let cell = collectionView.cellForItem(at: indexPath)
cell?.layer.borderWidth = 5.0
cell?.layer.borderColor = UIColor.black.cgColor
collectionView.allowsMultipleSelection = false
}
Run Code Online (Sandbox Code Playgroud)
但它允许我选择所有细胞而不仅仅是我喜欢的一个细胞.
点击表格单元格后,我将显示4到5秒的延迟,以显示警报视图.下面是代码
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath){
let cell = tableView.cellForRow(at: indexPath)!
let alertController = UIAlertController(title: nil, message: nil, preferredStyle: .alert)
let ok = UIAlertAction(title: "Ok", style: .default, handler: { (action) -> Void in
let cell = tableView.cellForRow(at: indexPath)!
})
let cancel = UIAlertAction(title: "Cancel", style: .cancel, handler: { (action) -> Void in
})
alertController.addAction(ok)
alertController.addAction(cancel)
present(alertController, animated: true, completion: nil)
}
Run Code Online (Sandbox Code Playgroud)
如何避免这种延迟?
我有3对按钮命名(one,numOne),(two,numTwo),(three,numThree)
.最初tintColor
的所有按钮都是black
.我想改变一对按钮的颜色,blue
如果这些按钮中的一个按钮被轻敲,并且black
当其他对被轻敲时返回.我可以通过以下代码来实现它,但是还有其他最短的方式吗?
@IBOutlet weak var one: UIButton!
@IBOutlet weak var two: UIButton!
@IBOutlet weak var three: UIButton!
@IBOutlet weak var numOne: UIButton!
@IBOutlet weak var numTwo: UIButton!
@IBOutlet weak var numThree: UIButton!
@IBAction func buttonTapped(_ sender: UIButton) {
if sender == one || sender == numOne
{
one.tintColor = UIColor.blue
numOne.tintColor = UIColor.blue
two.tintColor = UIColor.black
numTwo.tintColor = UIColor.black
three.tintColor = UIColor.black
numThree.tintColor = UIColor.black
}
else if sender == two …
Run Code Online (Sandbox Code Playgroud) 我的Tableview重用以前的单元格图像数据并显示以前单元格中的图像.我做了以下以防止它重复使用.我错过了什么?
@IBAction func cityBtn(_ sender: UIButton) {
for i in stride(from: 0, to: assignCities.count, by: 1)
{ cityName.append(bigCities[i])
cityImages.append(bigCityImages[i])
}}
public func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let myCell= tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath) as! CityCell
myCell.myLabel.text = cityName[indexPath.row]
let cityImg = cityImages[indexPath.row]
myCell.myImage.image = nil
if (cityImg != "")
{
myCell.myImage.image = UIImage(named:cityImg)
}
else
{
myCell.myImage.image = nil
}
return myCell
}
import UIKit
class CityCell: UITableViewCell {
@IBOutlet weak var myImage: UIImageView!
@IBOutlet weak …
Run Code Online (Sandbox Code Playgroud)