gpt4 book ai didi

cocoa-touch - UIRefreshControl 首次运行时标题偏移不正确,有时标题丢失

转载 作者:行者123 更新时间:2023-12-03 09:19:32 24 4
gpt4 key购买 nike

第一次启动 UIRefreshControl 时,文本偏移错误......后来有时刷新文本根本不显示,只有多刺可见

我不认为我在 iOS6 上有这个问题...可能与 iOS7 有关

是在作为子项添加到 VC 的 UITableViewController 中,它驻留在模态呈现的 UINavigationController 中

- (void)viewDidLoad {

[super viewDidLoad];

[self setRefreshControlText:@"Getting registration data"];
[self.refreshControl beginRefreshing];
}

- (void)setRefreshControlText:(NSString *)text {

UIFont * font = [UIFont fontWithName:@"Helvetica-Light" size:10.0];
NSDictionary *attributes = @{NSFontAttributeName:font, NSForegroundColorAttributeName : [UIColor blackColor]};
self.refreshControl.attributedTitle = [[NSAttributedString alloc] initWithString:text attributes:attributes];

}

enter image description here

enter image description here

最佳答案

这绝对是一个 iOS 7 错误,但我还没有弄清楚究竟是什么原因造成的。它似乎与 View 层次结构有关 - 将我的 UITableViewController 作为 subview 添加到包装 View Controller 似乎为我修复了它,尽管自 iOS 7 GM 以来该错误又回来了。

创建刷新 View 后,将以下代码添加到您的 UITableViewController 似乎可以永久修复定位问题:

dispatch_async(dispatch_get_main_queue(), ^{
[self.refreshControl beginRefreshing];
[self.refreshControl endRefreshing];
});

关于cocoa-touch - UIRefreshControl 首次运行时标题偏移不正确,有时标题丢失,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19121276/

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