woo*_*zly 18 overlay objective-c uirefreshcontrol ios7
我开始使用iOS 7 SDK在XCode 5下进行编程.当我使用'attributedText' 创建UITableViewController时UIRefreshControl,我已经将文本覆盖在UIRefreshControl图形顶部(圆形进度动画).
但当我拉下并松开手指时,文字会跳到正常位置.为什么会这样?
UIRefreshControl *refreshControl = [[UIRefreshControl alloc] init];
[refreshControl addTarget:self action:@selector(updateDeviceList) forControlEvents:UIControlEventValueChanged];
refreshControl.attributedTitle = [[NSAttributedString alloc] initWithString:@"Update Devices States"];
self.refreshControl = refreshControl;
Run Code Online (Sandbox Code Playgroud)
在结束之前:

后UIRefreshControl释放:

jei*_*oft 27
请试试这个.
- (void)viewDidLoad
{
[super viewDidLoad];
UIRefreshControl *refreshControl = [[UIRefreshControl alloc] init];
refreshControl.attributedTitle = [[NSAttributedString alloc] initWithString:@"Pull to Refresh"];
[refreshControl addTarget:self action:@selector(refresh:) forControlEvents:UIControlEventValueChanged];
self.refreshControl = refreshControl;
dispatch_async(dispatch_get_main_queue(), ^{
[self.refreshControl beginRefreshing];
[self.refreshControl endRefreshing];
});
}
Run Code Online (Sandbox Code Playgroud)