试图从我的UITableViewController到具有这些PFObjects的详细视图控制器...在此先感谢!准备segue ..从UITableView到DetailView与解析对象
错误我似乎无法调和...
“不能与类型‘字符串’的索引下标类型‘字符串’的值”我要被查询的对象呈现细节视图控制器上...
这里是我的查询和我的赛格瑞准备......我似乎无法访问该对象的SEGUE准备...
var customerName = [String]()
var customerAddress = [String]()
var query = Pfuser.query
query.whereKey("userId",equalTo:adminFollowingUser)
query.findObjectsInBackgroundWithBlock({ (adminObjects, error) -> Void in
if let objects = adminObjects {
for object in objects {
self.customerName.append(object["customerName"] as! String)
self.customerAddress.append(object["customerStreetAddress"] as! String)
//下面是准备赛格......
override func prepareForSegue(segue: UIStoryboardSegue, sender:
AnyObject?)
{
if (segue.identifier == "thesePools")
{
let employeeDetailVC: EmployeeDetailViewController = segue.destinationViewController
as! EmployeeDetailViewController
// indexPath is set to the path that was tapped
let indexPath = self.tableView.indexPathForSelectedRow
let customerNameLabel = self.customerName[indexPath!.row]
let customerAddressLabel = self.customerAddress[indexPath!.row]
employeeDetailVC.customerString = customerNameLabel
employeeDetailVC.addressString = customerAddressLabel
这里是我的详细视图控制器接收字符串。
//DetailViewController
var customerString = String()
var addressString = String()
override func viewDidLoad() {
super.viewDidLoad()
self.customerLabel.text = customerString
self.addressLabel.text = addressString
我得到了所有的错误,但当我点击单元格它仍然不会继续..我三重检查了segue名称,删除和redid它三倍检查目标视图控制器的类名称...不知道还有什么做..我会说这是答案...但它仍然不工作:( –
你有没有在故事板中的segue?你是怎么做到的?另外,如果你使用“didSelectRowAtIndexPath”,确保它不是“ didDeSelectRowAtIndexPath“,这是一个经常犯的错误,你也必须在表视图上”选择单击“,并将其绘制到视图控制器,以用于数据源和委托,并且必须实现tableviewcontroller委托。 /中。com/@ ronm333/a-simple-table-view-example-in-swift-cbf9a405f975 – user1700737
这个文章太棒了!用那篇文章想出来了!非常感谢网址:) –