sách gpt4 ai đã đi

ios - 获取标签栏的当前角标(Badge)编号

In lại 作者:行者123 更新时间:2023-12-01 18:58:45 27 4
mua khóa gpt4 Nike

我的应用程序中有一个标签,其中会带有徽章编号,该标签基于3个不同时间发生的3种不同操作。我知道如何使用以下方式设置标签栏标志:

[[[[[self tabBarController] tabBar] items]
objectAtIndex:3] setBadgeValue:[NSString stringWithFormat:@"%d", (int)thetabbadge]];

我想做的就是获取当前的证件号码(0代表什么,或者那里已经有任何号码),然后再增加另一个NSInteger。有没有办法读取当前的徽章编号属性?

1 Câu trả lời

您可以使用属性badgeValue

您的代码看起来像是五年前制作的,虚线符号更容易阅读。另外,您应该尽量不要在一排中做太多。

UITabBarItem *itemToBadge = self.tabBarController.tabBar.items[3];
int currentTabValue = [itemToBadge.badgeValue intValue];
int newTabValue = currentTabValue + 1; // Or whatever you want to calculate
itemToBadge.badgeValue = [NSString stringWithFormat:@"%d", newTabValue];

关于ios - 获取标签栏的当前角标(Badge)编号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24416521/

27 4 0
行者123
Hồ sơ cá nhân

Tôi là một lập trình viên xuất sắc, rất giỏi!

Nhận phiếu giảm giá Didi Taxi miễn phí
Mã giảm giá Didi Taxi
Giấy chứng nhận ICP Bắc Kinh số 000000
Hợp tác quảng cáo: 1813099741@qq.com 6ren.com