我目前正在尝试将UICollectionView作为UITableView,因此我必须设置“单元格分隔符”的颜色。 目前,我通过UITableView()。separatorColor获得颜色。 但是,出于某种奇怪的原因,这种颜色看起来比默认表格单元格分隔符的颜色要暗得多。
有谁知道如何获得正确的默认分隔符颜色?我猜测有一个不透明度相关联,因此导致我的自定义显示更暗。
答案 0 :(得分:0)
您可以通过执行此操作设置分隔符的颜色
for (int i = 0; i<arrayPhotosData.count; i++) {
CFStringRef fileExtension = (__bridge CFStringRef) [stringFileName pathExtension];
CFStringRef fileUTI = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, fileExtension, NULL);
if (UTTypeConformsTo(fileUTI, kUTTypeImage))
{
NSDictionary *dictionaryFinal =@{@"usrContentFolderId" : @(0),
@"mediaTypeId" : @(2),
@"contentTypeId" : @(intProfileType),
@"userContentFileName" : stringFileName,
@"userContentFileSize" : @(0),
@"makePublic" : [NSNumber numberWithBool:true]
};
[arrayPOSTFinalImage addObject:dictionaryFinal];
}
else if (UTTypeConformsTo(fileUTI, kUTTypeMovie))
{
NSDictionary *dictionaryFinal =@{@"usrContentFolderId" : @(0),
@"mediaTypeId" : @(4),
@"contentTypeId" : @(intProfileType),
@"userContentFileName" : stringFileName,
@"userContentFileSize" : @(0),
@"makePublic" : [NSNumber numberWithBool:true]
};
[arrayPOSTFinalImage addObject:dictionaryFinal];
}
else if (UTTypeConformsTo(fileUTI, kUTTypeText))
{
NSDictionary *dictionaryFinal =@{@"usrContentFolderId" : @(0),
@"mediaTypeId" : @(1),
@"contentTypeId" : @(intProfileType),
@"userContentFileName" : stringFileName,
@"userContentFileSize" : @(0),
@"makePublic" : [NSNumber numberWithBool:true]
};
[arrayPOSTFinalImage addObject:dictionaryFinal];
}
}
dictionaryUserContentRequest =@{ @"userContentsRequest":arrayPOSTFinalImage};
NSError *error;
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:dictionaryUserContentRequest
options:NSJSONWritingPrettyPrinted // Pass 0 if you don't care about the readability of the generated string
error:&error];
if (! jsonData) {
NSLog(@"Got an error: %@", error);
} else {
jsonString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
NSLog(@"JSONSTRINGPOSTIMAGE===%@",jsonString);
}
NSMutableURLRequest *request=[[AFHTTPRequestSerializer serializer] multipartFormRequestWithMethod:@"POST" URLString:urlFileUpload parameters:@{@"requestParam":jsonString} constructingBodyWithBlock:^(id<AFMultipartFormData> formData)
{
for (int i=0; i<[arrayPhotosData count]; i++)
{
NSString *stringFileName=arrayFileName[i];
CFStringRef fileExtension = (__bridge CFStringRef) [stringFileName pathExtension];
CFStringRef fileUTI = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, fileExtension, NULL);
if (UTTypeConformsTo(fileUTI, kUTTypeImage))
{
[formData appendPartWithFileData:arrayPhotosData[i] name:@"file" fileName:stringFileName mimeType:@"image/jpeg"];
}
else if (UTTypeConformsTo(fileUTI, kUTTypeMovie))
{
[formData appendPartWithFileData:arrayPhotosData[i] name:@"file" fileName:stringFileName mimeType:@"video/quicktime"];
}
else if ([arrayExtension[i] isEqualToString:@"pdf"])
{
[formData appendPartWithFileData:arrayPhotosData[i] name:@"file" fileName:stringFileName mimeType:@"application/pdf"];
}
if (UTTypeConformsTo(fileUTI, kUTTypeText))
{
[formData appendPartWithFileData:arrayPhotosData[i] name:@"file" fileName:stringFileName mimeType:@"text/plain"];
}
}
}error:nil];
NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration defaultSessionConfiguration];
configuration.HTTPAdditionalHeaders = @{
@"Authorization": stringToken,
};
AFURLSessionManager *manager = [[AFURLSessionManager alloc] initWithSessionConfiguration:configuration];
NSURLSessionUploadTask *uploadTask;
uploadTask = [manager
uploadTaskWithStreamedRequest:request
progress:^(NSProgress * _Nonnull uploadProgress) {
}
completionHandler:^(NSURLResponse * _Nonnull response, id _Nullable responseObject, NSError * _Nullable error) {
if (error) {
NSLog(@"ERROR ---%@",error);
}
else
{}];
答案 1 :(得分:0)
尝试
UITableView().separatorColor