美文网首页
2019-03-19 iOS WKWebview 的 scrol

2019-03-19 iOS WKWebview 的 scrol

作者: Cocoa_Coder | 来源:发表于2019-03-19 09:55 被阅读0次

如题,在这个WkWebview的代理中:

-(void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation;

执行 [webview.scrollView setContentOffset:animated:] 方法,会出现不工作的问题,解决方法是延时执行这一方法

dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
            
            [self.webView.scrollView setContentOffset:animated:];

        });

关于日历->选择佛历以及日本日历的处理方法:

非公历日期,添加本地化

NSDateFormatter *formatter = [[NSDateFormatter alloc] init];

if (![[NSCalendar autoupdatingCurrentCalendar].calendarIdentifier isEqualToString:NSCalendarIdentifierGregorian]) {//非公历日期,添加本地化
        NSLocale *locale = [[NSLocale alloc] initWithLocaleIdentifier:[[NSLocale preferredLanguages] objectAtIndex:0]];
        [formatter setLocale:locale];
    }

相关文章

网友评论

      本文标题:2019-03-19 iOS WKWebview 的 scrol

      本文链接:https://www.haomeiwen.com/subject/hmiwmqtx.html