设为首页 加入收藏

TOP

Swift中 删除Array的元素对象
2019-08-26 07:06:15 】 浏览:25
Tags:Swift 删除 Array 元素 对象

Swift中Array的删除对象

在Swift中数组Array没有removeObject的方法

1、找到下标

 let model_index = selectedArray.index(where: { (arr) -> Bool in

   ((selectedBeaconArray.index(of: vbModel)) != nil)

 })

2、删除下标对应的元素

if model_index != nil{

  selectedBeaconArray.remove(at: model_index ?? 0)

}

】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇BAT面试总结——iOS开发高级工程师 下一篇Mixin Messenger 源码解读 1 — ..

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目