gpt4 book ai didi

iphone - 删除 UITabBarItem

转载 作者:行者123 更新时间:2023-12-03 18:51:59 29 4
gpt4 key购买 nike

如何从 UITabBar 中删除 UITabBarItem

我还没有尝试过任何东西,因为我没有从 Google 搜索或 UITabBarUITabBarControllerUITabBarItem 的文档中找到任何内容>.

提前致谢! :)

最佳答案

UITabBar有一个 NSArray元素的集合。由于 items 属性是 NSArray 而不是 NSMutableArray ,您必须从现有的没有要删除的对象的 NSArray 构造一个新的 NSArray,然后将 items 属性设置为新数组。

/* suppose we have a UITabBar *myBar, and an int index idx */
NSMutableArray *modifyMe = [[myBar items] mutableCopy];
[modifyMe removeObjectAtIndex:idx];
NSArray *newItems = [[NSArray alloc] initWithArray:modifyMe];
[myBar setItems:newItems animated:true];

关于iphone - 删除 UITabBarItem,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4037160/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com