ios - 从 1 个 swift UISPLITVIEWCONTROLLER 中的更多 2 个类加载

标签 ios xcode swift class uisplitviewcontroller

我尝试查找如何从另一个类加载此数据的信息我有一个UISplitViewController并且里面有很多信息我尝试从1个类中的2个不同类加载Theta有人可以帮助我吗请问?

searchController.searchBar.scopeButtonTitles = ["All", "Chocolate", "Hard", "Other"]
tableView.tableHeaderView = searchController.searchBar

candies = [

//I want to load the first2 candy from another Swift class

Candy(category:"go", name:"slow"),
Candy(category:"run", name:"feast"),

//and the least 2 Candy to load from another Swift class

Candy(category:"deanc", name:"good"),
Candy(category:"fly", name:"whery feast"),

最佳答案

我有点难以理解你想做什么。但让我试一下:

let candies1 = [Candy(category:"go", name:"slow"),
Candy(category:"run", name:"feast")]

let candies2 =  [Candy(category:"deanc", name:"good"),
Candy(category:"fly", name:"whery feast")]

现在您可以在任何您想要的类和函数中使用 candies1 和 candies2 。 让我知道你的想法

关于ios - 从 1 个 swift UISPLITVIEWCONTROLLER 中的更多 2 个类加载,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37530225/

相关文章:

swift - 使用核心数据获取请求时,Xcode 错误提示 "cannot find type ' TestModelCoreData' in scope,但它编译并运行

xcode - Git merge 二进制文件(特别是 Xcode 项目文件)

ios - 如何将 ipa 文件部署到 artifactory?

ios - Xcode 的文件添加选项之间的差异

iOS:智能刷新注释

swift - 识别范围重叠

iOS 本地化、模拟器和设备始终使用 Base.lproj 而不是用户首选的区域设置

ios - 我可以从 iOs 应用程序重定向到启动器屏幕吗?

ios - autolayout 可以自动布局这个(附图)吗?

android - 使用不透明蒙版时图像的自动变换失败