小编GSK*_*985的帖子

WKWebView in UITableViewCell disappearing content

I'm trying to setup a TableView to display my content as follows: 1 [HEADING PHOTO] 2. Content from URL 3. Related items from Json 4. [FOOTER]

Cell 1 is working properly, for cell 2 I have a dynamic height, which gets updated once the content is reloaded. However, if my content (and also the cell) is bigger than my screen it's not show. Only on a zoom gesture the text appears. I can scroll, down, since the Cell and WebView …

webview uitableview swift wkwebview

5
推荐指数
0
解决办法
849
查看次数

NSURLConnection expectedContentLength返回-1

我正在尝试在下载文件时查看进度条.该文件是通过PHP生成的,我发送的是"Content-length"标题,实际上可以正常工作.

文件下载正常,这不是问题.不幸的是,我无法获取文件大小以便正确显示进度条.

这是我的代码:

write_to_filename = [issue objectForKeyedSubscript:filename];
NSString *post =[[NSString alloc] initWithFormat:@"user_id=%@&email=%@&password=%@",[userData stringForKey:@"userId"],[userData stringForKey:@"email"],[userData stringForKey:@"password"]];
NSData *postData = [post dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES];

NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"http://MY_API_REQUEST"]];

NSString *postLength = [NSString stringWithFormat:@"%d", [postData length]];

[request setValue:@"application/pdf" forHTTPHeaderField:@"Accept"];
[request setValue:postLength forHTTPHeaderField:@"Content-Length"];
[request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];
[request setHTTPMethod:@"POST"];
[request setHTTPBody:postData];
[NSURLConnection connectionWithRequest:request delegate:self];

[issueArray writeToFile:[self saveFilePath] atomically:YES];
Run Code Online (Sandbox Code Playgroud)

NSURLConnection

- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse 

*)response {

    NSLog(@"%lld",[response expectedContentLength]);
    _responseData = [[NSMutableData alloc] init];

}

- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data {
    [_responseData appendData:data];
}

- (NSCachedURLResponse …
Run Code Online (Sandbox Code Playgroud)

ios progress-bar

4
推荐指数
1
解决办法
699
查看次数

标签 统计

ios ×1

progress-bar ×1

swift ×1

uitableview ×1

webview ×1

wkwebview ×1