不要显示名单医生的姓氏和姓氏

时间:2016-06-03 08:49:24

标签: ios swift

我写的应用程序获取列表的姓氏和姓氏我在使用RestKit和MLPAutoCompleteTextField时写下姓氏并不显示自动填充文本

  var listDoctors = [String]()

    func autoCompleteTextField(textField: MLPAutoCompleteTextField!, possibleCompletionsForString string: String!, completionHandler handler: ([AnyObject]!) -> ()) {


        let appDelegate: AppDelegate = (UIApplication.sharedApplication().delegate as! AppDelegate)
        var requestParameters: [NSObject:AnyObject] = [NSObject: AnyObject]()

        requestParameters["name"] = textField.text

        appDelegate.objectManager.getObjectsAtPath("/doctors", parameters: requestParameters, success: {
            (rkoperation: RKObjectRequestOperation!, rkmap: RKMappingResult!) -> Void in

            if let doctors = rkmap.array() as? [Doctor] {
                for doctor: Doctor in doctors {

                    let nameDoctors = doctor.firstname
                    let lastnameDoctors = doctor.lastname
                    let list = nameDoctors + lastnameDoctors
                    self.listDoctors.append(list)

                }
            }

            handler(self.listDoctors)
            }, failure: {
                (rkoperation: RKObjectRequestOperation!, error: NSError!) -> Void in
                print("Load filed with error: @", error!)
                self.performSelectorOnMainThread(#selector(AppDelegate.showFetchError), withObject: nil, waitUntilDone: true)
        })
    }
}

0 个答案:

没有答案