我是swift编程的新手
弹出菜单选择调用此功能后
func didSelectData(_ result: String){
self.attendanceInfo.removeAll()
if(result == "All Student"){
self.attendanceInfo = self.attendanceInfoDupilicate
}
else if(result == "Present Student" ){
self.attendanceInfo.removeAll()
let itemsarray = self.attendanceInfoDupilicate
for AttendanceInfo in itemsarray {
if(AttendanceInfo.attendance.range(of: "PRESENT", options: .caseInsensitive) != nil){
self.attendanceInfo.append(AttendanceInfo)
}
}
} else{
self.attendanceInfo.removeAll()
let itemsarray = self.attendanceInfoDupilicate
for AttendanceInfo in itemsarray {
if(AttendanceInfo.attendance.range(of: "ABSENT", options: .caseInsensitive) != nil){
self.attendanceInfo.append(AttendanceInfo)
===========>. I have to append the attendance = ""; to AttendanceInfo
}
}
}
self.TableView.reloadData()
}
服务调用Json Data后
我正在显示 出勤=现在 出勤率=缺席
但如何附加
的json数据出勤=“”;功能的didSelectData
请帮帮我
答案 0 :(得分:3)
尝试
if (AttendanceInfo.attendance.range(of: "ABSENT", options: .caseInsensitive) != nil) || AttendanceInfo.attendance.isEmpty {
}