如何从服务器中删除NSMutableArray中的JSON数据。如何删除NSMutableArray的数据
var jsondata : NSMutableArray!
func retrieve(){
let requrl: NSURL = NSURL(string: "http://localhost/tara/forvbc.php")!
let dataurl = NSData(contentsOfURL: requrl)
jsondata = try! NSJSONSerialization.JSONObjectWithData(dataurl!, options: .MutableContainers) as! NSMutableArray
}
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = thview.dequeueReusableCellWithIdentifier("thecell", forIndexPath: indexPath) as UITableViewCell
let asdasd = jsondata[indexPath.row]\
cell.textLabel?.text = jsondata["name"] as? String
return cell
}
我喜欢用commitEditingStyle
override func tableView(tableView: UITableView, commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath) {
if editingStyle == .Delete{
}
}
谢谢你们的合作,将其删除。
[从的NSMutableArray卸下对象(http://stackoverflow.com/questions/2757046/removing-object-from-nsmutablearray) – Tibrogargan
对不起的可能的复制,我认为我们只有相同的标题,但是这是从一个可用的项目中删除。 – johnyald
显示在UITable中的数据仍由MSMutableArray支持,MSMutableArray应与显示无关。不要紧,你的数据来自最初的地方,从它删除通常会使用'removeObjectsInArray:'或'removeObjectsAtIndexes:' – Tibrogargan