我想为属于UIWebView的scrollView的contentInset设置动画。我尝试了以下代码,但不幸的是,插件只是在运行时跳转
UIViewAnimationOptions options = UIViewAnimationOptionBeginFromCurrentState;
[UIView animateWithDuration:10.0 delay:0 options:options animations:^
{
self.webView.scrollView.contentInset = UIEdgeInsetsMake(100 ,120,120,120);
}
completion:nil];
有谁知道如何制作一个平滑的contentInset动画? 我也试过了没有运气的AllowAnimatedContent选项
答案 0 :(得分:3)
尝试这样的事情:
[timeDict setObject:@"Hello" forKey:@"Greetings"];
[timeDict setObject:@"Bye" forKey:@"B_Key"];
[timeDict setObject:@"what?" forKey:@"W_Key"];
[[NSUserDefaults standardUserDefaults] setObject:timeDict forKey:@"Greetings"];
[[NSUserDefaults standardUserDefaults] setObject:timeDict forKey:@"B_Key"];
[[NSUserDefaults standardUserDefaults] setObject:timeDict forKey:@"W_Key"];
[[NSUserDefaults standardUserDefaults] synchronize];
timeDict = [[NSUserDefaults standardUserDefaults] objectForKey:@"Greetings"];
timeDict = [[NSUserDefaults standardUserDefaults] objectForKey:@"B_Key"];
timeDict = [[NSUserDefaults standardUserDefaults] objectForKey:@"W_Key"];
答案 1 :(得分:0)
UIView.animate({
self.tableView.contentInset = .init(top: tableViewOffset, left: 0, bottom: 0, right: 0)
self.tableView.setContentOffset(.init(x: 0, y: -tableViewOffset), animated: false)
}, onComplete: { Swift.print("Anim completed") })