Ich versuche herauszufinden, wie ich die Daten filtern und die Tabellenansicht neu laden kann.Ich habe 4 Regionen (Nord, Süd, Ost und West) und alle.Standardmäßig werden alle Profile angezeigt.
Wenn ich auf „Norden“ (d. h. 1) drücke, werden nur die in der Nordregion verfügbaren Profile gefiltert
Das Gleiche gilt für Süden, Osten und Westen. Abhängig von der gedrückten Region sollte das Profil gefiltert werden.
Und, wie im zweiten Screenshot (Südregion) zu sehen ist Das Profil sollte ausgeblendet werden, da es zur Region Nord gehört.
Bitte lassen Sie mich wissen, wie ich das beheben kann.
Vielen Dank für die Zeit: )
Modell:
let id = String(describing: dictionary["id"]!)
let name = String(describing: dictionary["BUSINESS_NAME"]!)
let email = String(describing: dictionary["EMAIL"]!)
var streetNo = String(describing: dictionary["STREET_NO"]!)
var streetName = String(describing: dictionary["STREET_NAME"]!)
var suburbID = String(describing: dictionary["SUBURB_ID"]!)
var postCode = String(describing: dictionary["POSTCODE"]!)
let regionID = String(describing: dictionary["REGION_ID"]!)
var landline = String(describing: dictionary["PHONE_FIXED"]!)
var mobile = String(describing: dictionary["PHONE_MOBILE"]!)
let website = String(describing: dictionary["WEBURL"]!)
var suburbName = String(describing: dictionary["Suburb"]!)
let streedNoHide = String(describing: dictionary["STREET_NO_HIDDEN"]!)
let streetNameHide = String(describing: dictionary["STREET_NAME_HIDDEN"]!)
let suburbHide = String(describing: dictionary["SUBURB_HIDDEN"]!)
let postCodeHide = String(describing: dictionary["POSTCODE_HIDDEN"]!)
let mobileHide = String(describing: dictionary["PHONE_MOBILE_HIDDEN"]!)
let landlineHide = String(describing: dictionary["PHONE_FIXED_HIDDEN"]!)
Ich versuche herauszufinden, wie ich die Daten filtern und die Tabellenansicht neu laden kann.[b]Ich habe 4 Regionen (Nord, Süd, Ost und West) und alle.Standardmäßig werden alle Profile angezeigt. Wenn ich auf „Norden“ (d. h. 1) drücke, werden nur die in der Nordregion verfügbaren Profile gefiltert Das Gleiche gilt für Süden, Osten und Westen. Abhängig von der gedrückten Region sollte das Profil gefiltert werden. [code]func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
if indexPath.section == 0 { let cell = self.businessTableView.dequeueReusableCell(withIdentifier: "businessCell", for: indexPath) as! BusinessCell
let tableObjects:StorageSubCatagoriezTwo = subCatagorizeDataTwo[indexPath.row]
} return cell } else if indexPath.section == 1 { let cell = self.businessTableView.dequeueReusableCell(withIdentifier: "businessCell2") cell?.textLabel?.textAlignment = .center switch regId { case 0: if subCatagorizeDataTwo.count != forAll { cell?.textLabel?.text = "LOAD MORE DATA" cell?.textLabel?.textColor = Color.whiteColor cell?.backgroundColor = UIColor.darkGray
}else{ cell?.textLabel?.text = "NO MORE FOUND!" cell?.textLabel?.textColor = UIColor.darkGray cell?.backgroundColor = UIColor.gray cell?.selectionStyle = UITableViewCellSelectionStyle.none } case 1: if subCatagorizeDataTwoN.count != forN { cell?.textLabel?.text = "LOAD MORE DATA" cell?.textLabel?.textColor = Color.whiteColor cell?.backgroundColor = UIColor.darkGray
}else{ cell?.textLabel?.text = "NO MORE FOUND!" cell?.textLabel?.textColor = UIColor.darkGray cell?.backgroundColor = UIColor.gray cell?.selectionStyle = UITableViewCellSelectionStyle.none } case 2: if subCatagorizeDataTwoE.count != forE { cell?.textLabel?.text = "LOAD MORE DATA" cell?.textLabel?.textColor = Color.whiteColor cell?.backgroundColor = UIColor.darkGray
}else{ cell?.textLabel?.text = "NO MORE FOUND!" cell?.textLabel?.textColor = UIColor.darkGray cell?.backgroundColor = UIColor.gray cell?.selectionStyle = UITableViewCellSelectionStyle.none } case 3: if subCatagorizeDataTwoS.count != forS { cell?.textLabel?.text = "LOAD MORE DATA" cell?.textLabel?.textColor = Color.whiteColor cell?.backgroundColor = UIColor.darkGray
}else{ cell?.textLabel?.text = "NO MORE FOUND!" cell?.textLabel?.textColor = UIColor.darkGray cell?.backgroundColor = UIColor.gray cell?.selectionStyle = UITableViewCellSelectionStyle.none } case 4: if subCatagorizeDataTwoW.count != forW { cell?.textLabel?.text = "LOAD MORE DATA" cell?.textLabel?.textColor = Color.whiteColor cell?.backgroundColor = UIColor.darkGray
}else{ cell?.textLabel?.text = "NO MORE FOUND!" cell?.textLabel?.textColor = UIColor.darkGray cell?.backgroundColor = UIColor.gray cell?.selectionStyle = UITableViewCellSelectionStyle.none }
default:break }
return cell! } else { let tableObjects:StorageSubCatagoriez3rd = SubCatagoriez3rd[indexPath.row] let cell = self.businessTableView.dequeueReusableCell(withIdentifier: "businessCell3") cell?.textLabel?.text = tableObjects.nameString return cell! } } [/code] Bitte sehen Sie sich den Screenshot an: [img]https://i.sstatic.net/xmHwS .png[/img]
[img]https://i.sstatic.net/hNZm0.png[/img] Und, wie im zweiten Screenshot (Südregion) zu sehen ist Das Profil sollte ausgeblendet werden, da es zur Region Nord gehört. Bitte lassen Sie mich wissen, wie ich das beheben kann. Vielen Dank für die Zeit: ) Modell: [code]class StorageSubCatagoriezTwo { var nameString:String var idString:String var address:String var telephone:String var email:String var website:String
class StorageSubCatagoriezTwoEast { var nameString:String var idString:String var address:String var telephone:String var email:String var website:String
class StorageSubCatagoriezTwoWest { var nameString:String var idString:String var address:String var telephone:String var email:String var website:String
class StorageSubCatagoriezTwoSouth { var nameString:String var idString:String var address:String var telephone:String var email:String var website:String
init(tempName:String,tempID:String,tempaddress:String,tempTelephone:String,tempEmail:String,tempWebsite:String) { self.nameString = tempName.trimmingCharacters(in: CharacterSet.whitespacesAndNewlines) self.idString = tempID.trimmingCharacters(in: CharacterSet.whitespacesAndNewlines) self.address = tempaddress.trimmingCharacters(in: CharacterSet.whitespacesAndNewlines) self.telephone = tempTelephone.trimmingCharacters(in: CharacterSet.whitespacesAndNewlines) self.email = tempEmail.trimmingCharacters(in: CharacterSet.whitespacesAndNewlines) self.website = tempWebsite.trimmingCharacters(in: CharacterSet.whitespacesAndNewlines) } } [/code] Region abrufen und der Variablen zuweisen: [code]let id = String(describing: dictionary["id"]!) let name = String(describing: dictionary["BUSINESS_NAME"]!) let email = String(describing: dictionary["EMAIL"]!) var streetNo = String(describing: dictionary["STREET_NO"]!) var streetName = String(describing: dictionary["STREET_NAME"]!) var suburbID = String(describing: dictionary["SUBURB_ID"]!) var postCode = String(describing: dictionary["POSTCODE"]!) let regionID = String(describing: dictionary["REGION_ID"]!) var landline = String(describing: dictionary["PHONE_FIXED"]!) var mobile = String(describing: dictionary["PHONE_MOBILE"]!) let website = String(describing: dictionary["WEBURL"]!) var suburbName = String(describing: dictionary["Suburb"]!) let streedNoHide = String(describing: dictionary["STREET_NO_HIDDEN"]!) let streetNameHide = String(describing: dictionary["STREET_NAME_HIDDEN"]!) let suburbHide = String(describing: dictionary["SUBURB_HIDDEN"]!) let postCodeHide = String(describing: dictionary["POSTCODE_HIDDEN"]!) let mobileHide = String(describing: dictionary["PHONE_MOBILE_HIDDEN"]!) let landlineHide = String(describing: dictionary["PHONE_FIXED_HIDDEN"]!) [/code] JSON-DATEN: (REGION_ID) [img]https://i.sstatic.net /72Y2M.png[/img]
Ich versuche, einige Daten von einer API abzurufen. Es ruft die Daten einwandfrei ab, wenn ich die Funktion mit einer IBAction verbinde, aber es funktioniert nicht, wenn ich sie bei viewDidLoad() als...
Ich versuche, Duplikate aus der Tabellenansicht zu entfernen. Die in der Tabellenansicht abgerufenen Daten stammen aus einer externen Datenbank. Einige der abgerufenen Daten werden einige Male...
Ich bin versuche, eine Abfrage im Codesigniter -Modell auszuführen. Es funktioniert, aber wenn ich die Abfrage der Modellfunktion echo echo wie unten ist.
SELECT * FROM `table1` WHERE `id` = '17'...