Xcode beta 6改变了一些Swift语言
由于'id'现在导入为'Any'而不是'AnyObject',因此您可能会看到先前在'AnyObject'上执行动态查找的错误.
我已经尝试将修复程序在执行动态查找之前显式转换为AnyObject,或者强制转换为特定的对象类型
但我不确定我是否正确地做到了 - 有人可以帮助请在这里是来自Beta 5的原始工作代码
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath) as! SpecialCell
let maindata = values[(indexPath as NSIndexPath).row]
cell.name.text = maindata["name"] as? String
cell.id.text = maindata["id"] as? String
//team_id.text = maindata["team_id"] as? String
return cell
}
Run Code Online (Sandbox Code Playgroud)
https://www.dropbox.com/s/ln0vx3b9rbywv83/Screen%20Shot%202016-08-18%20at%2014.32.23.png?dl=0
我有一些很好的代码,允许我拍照和图像,然后在应用程序中显示它.我还将profilePic.image上传到我的数据库(作为一个blob),但我意识到这实际上并没有上传图像本身,只是关于图像的数据所以我无法渲染任何东西,因为没有任何东西可以解码.因此,我希望转换此函数以获取所选图像并将其编码为base64并使用相同的工作上载
func imagePickerController(
_ selectImage: UIImagePickerController,
didFinishPickingMediaWithInfo info: [String : AnyObject])
{
let chosenImage = info[UIImagePickerControllerEditedImage] as! UIImage //2
// imageByCroppingToRect()
profilePic.contentMode = .scaleAspectFit //3
profilePic.image = chosenImage //4
dismiss(animated: true, completion: nil) //5
}
Run Code Online (Sandbox Code Playgroud) 我有一个数据表,从mysql在页面上通过PHP呈现到HTML表中.
在这个数据表中,我有一行数据应该集中在(我们称之为)行X上.
我想要显示行X上方和下方的2行,但是其他所有其他都隐藏了,因为行X上下移动,这会改变(显然)隐藏的内容,当行X位于顶部/底部时我想要显示4行/低于/高于.
我用静态内容和JQuery完成了这个,我只是不确定如何跟踪行X然后根据需要应用类名
我想将提醒保存到默认提醒位置。但是当我按下按钮时,我收到一个致命错误:在展开可选值时意外发现 nil...我对此很陌生,我找到的大多数示例都过于复杂或不在 Swift 3 中。
class ViewController: UIViewController {
var eventStore: EKEventStore?
@IBOutlet weak var reminderText: UITextField!
@IBAction func setReminder(_ sender: Any) {
let reminder = EKReminder(eventStore: self.eventStore!)
reminder.title = "Go to the store and buy milk"
reminder.calendar = (eventStore?.defaultCalendarForNewReminders())!
do {
try eventStore?.save(reminder,
commit: true)
} catch let error {
print("Reminder failed with error \(error.localizedDescription)")
}
}
}
Run Code Online (Sandbox Code Playgroud)