UIApplication removeStatusBarImageNamed 不起作用
我正在使用 iOS 5.0.1 的越狱 iPhone,只想访问状态栏图像, 我的代码如下:
-(void)addStatusBarImage
{
NSLog(@"addStatusBarImage");
[[UIApplication sharedApplication] addStatusBarImageNamed:@"sgtest" removeOnExit: YES];
}
-(void)removeStatusBarImage
{
NSLog(@"removeStatusBarImage");
[[UIApplication sharedApplication] removeStatusBarImageNamed:@"sgtest"];
}
我的问题是,add 函数工作正常,但removeStatusBarImageNamed 似乎无用,因为“sgtest”图像仍然存在于状态栏中,除非我的应用程序终止。
i'm working on a jailbroken iphone with iOS 5.0.1, just want to access status bar image,
and my code is as follows:
-(void)addStatusBarImage
{
NSLog(@"addStatusBarImage");
[[UIApplication sharedApplication] addStatusBarImageNamed:@"sgtest" removeOnExit: YES];
}
-(void)removeStatusBarImage
{
NSLog(@"removeStatusBarImage");
[[UIApplication sharedApplication] removeStatusBarImageNamed:@"sgtest"];
}
my problem is, the add function works fine, but removeStatusBarImageNamed seems useless as the "sgtest" image still exists in the status bar unless my app is terminated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
状态栏图标管理器修复了哪些线程已设置图标图像。如果另一个线程尝试删除该图标,则会失败。您需要在一个线程中完成它。
查看 github 上的 SpringBoardAccess 项目。您可以按原样使用它或类似地实施。
status bar icon manager fix what thread have had set icon image. if another thread try to remove that icon, it fails. You need to do it in one thread.
Check out SpringBoardAccess project at github. You can use it as is or implement like.