如何缩小图像而不会以编程方式影响质量.
捕获图像后,我想减小图像的大小而不改变objective-c的质量.
在我尝试做的过程中获取错误只是创建我的自定义类的实例
class CustomDetailView: UIImageView {
let packThumbImage = UIImageView()
let packFrameImage = UIImageView()
let packNameLabel = UILabel()
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
}
override init(frame: CGRect) {
super.init(frame: frame)
}
}
Run Code Online (Sandbox Code Playgroud)
var customPackView = CustomDetailView()//这里出错
我的应用程序在iOS 6上工作正常.升级后我停止了从我的删除行UITableView.
我的原型单元格中有一个按钮.
这是按钮的功能:
- (IBAction)deleteCell:(id)sender {
UIButton *btn = (UIButton*) sender;
UITableViewCell *cell = (UITableViewCell*) btn.superview.superview;
NSIndexPath *indexPath = [_tableView indexPathForCell:cell];
if([names count] > 9) {
int index = indexPath.row;
[names removeObjectAtIndex:index];
[photos removeObjectAtIndex:index];
[_tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationRight];
}
}
Run Code Online (Sandbox Code Playgroud)
问题是我的索引变量始终为0.
我试过另一个解决方案
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
if (editingStyle == UITableViewCellEditingStyleDelete) {
int index = indexPath.row;
[names removeObjectAtIndex:index];
[photos removeObjectAtIndex:index];
[_tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationRight];
}
}
Run Code Online (Sandbox Code Playgroud)
此解决方案也不起作用.当我向右滑动时没有任何反应.
我试图(Google)在我的新应用程序中实现社交登录.为此我点了这个链接:https://developers.google.com/identity/sign-in/ios/start-integrating 并成功添加了谷歌登录和获取的用户基本信息.但我陷入了退出流程.对于注销我写了以下行,但仍然没有删除用户数据.当我再次尝试登录时,它会选择最后一个gmail id.
[[GIDSignIn sharedInstance] signOut];
Run Code Online (Sandbox Code Playgroud)
我试图找到解决方案.但没有运气.如果有人经历过这个,请分享.或者谷歌登录和注销还有其他方法吗?
提前致谢!
我成功地WKWebView以编程方式添加了一个 In a viewController(in viewDidLoad())。当加载包含视频的网址时,它看起来很好,但是当我尝试点击它(播放它)时,我看不到它,但音频工作正常。
奇怪的是,我创建了一个新项目只是为了确保它能正常工作,而且确实如此,我复制了与 webView 显示视频相同的代码。
在转换为 Swift 3 之前它运行良好。
这是点击视频时的样子:
敲击前:
点击后:
我还尝试了另一个网页:
敲击前:
点击后(请注意,状态栏现在已隐藏):
简单来说,就是这样的代码:
override func viewDidLoad() {
super.viewDidLoad()
let web = WKWebView(frame: view.frame)
let urlRequest = URLRequest(url: URL(string: "http://www.w3schools.com/html/html5_video.asp")!)
web.frame = view.frame
web.load(urlRequest)
view.addSubview(web)
}
Run Code Online (Sandbox Code Playgroud)
我尝试检查很多情况,但没有任何输出。我缺少什么?
提前致谢。
我试图在上捕获图像iOS10,将其以原始格式存储,然后再处理。拍摄和保存图像不是问题,但是当我稍后尝试使用CIFIlter(imageData:options :)打开DNG文件时,filter.outputImage为nil。这是我的代码:
拍摄图像:
func capture(_ captureOutput: AVCapturePhotoOutput,
didFinishProcessingRawPhotoSampleBuffer rawSampleBuffer: CMSampleBuffer?,
previewPhotoSampleBuffer: CMSampleBuffer?,
resolvedSettings: AVCaptureResolvedPhotoSettings,
bracketSettings: AVCaptureBracketedStillImageSettings?,
error: Error?) {
if let rawSampleBuffer = rawSampleBuffer,
let data = AVCapturePhotoOutput.dngPhotoDataRepresentation(forRawSampleBuffer: rawSampleBuffer, previewPhotoSampleBuffer: previewPhotoSampleBuffer) {
// rawFilePath is a filename in my sandbox
FileManager.default.createFile(atPath: rawFilePath, contents: data, attributes: nil)
}
}
Run Code Online (Sandbox Code Playgroud)
该文件已按预期保存,我可以在lightroom中打开它而不会出现问题。
这是再次读取文件的代码:
let imageData = try? Data(contentsOf: URL(fileURLWithPath: rawFilePath))
if imageData == nil {
return nil
}
let filter = CIFilter(
imageURL: URL(fileURLWithPath: filename),
options: [String(kCGImageSourceTypeIdentifierHint): "com.adobe.raw-image"]
)
let ciImage: …Run Code Online (Sandbox Code Playgroud) Job Schedular设置如下
ComponentName mServiceComponent = new ComponentName(context, TestJobService.class);
JobInfo.Builder builder = new JobInfo.Builder(jobId, mServiceComponent);
builder.setPeriodic(3 * 60 * 1000);
builder.setRequiredNetworkType(JobInfo.NETWORK_TYPE_NONE);
builder.setRequiresDeviceIdle(false);
builder.setRequiresCharging(false);
builder.setPersisted(true);
JobScheduler jobScheduler = (JobScheduler) ChaseForceApplication.getAppContext().getSystemService(Context.JOB_SCHEDULER_SERVICE);
jobScheduler.schedule(builder.build());
Run Code Online (Sandbox Code Playgroud)
TestJobService类是这样的:
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public class TestJobService extends JobService {
@Override
public boolean onStartJob(JobParameters params) {
Utility.writeToTheFile(ChaseForceApplication.getAppContext(), "\n\n Job Scheduler StartJob with jobid="+params.getJobId()+" set at " + new Date().toString());
sendBroadcast(new Intent(this, OnSingleAlarmReceiver.class));
return false;
}
@Override
public boolean onStopJob(JobParameters params) {
Log.i(ChaseForceApplication.TAG, "on stop job: " + params.getJobId());
Utility.writeToTheFile(this, "on stop job: " …Run Code Online (Sandbox Code Playgroud) 我想向用户显示一个文本,以通知数据源中没有内容.例如,如果你没有联系人,你可以在联系人应用程序中看到这种行为,它在表格中间用灰色文本表示.有没有简单的方法来做到这一点,或者我必须使用一些技巧,如创建空单元格或东西..谢谢!
我有一个浮点数,我在其中插入逗号数千后它工作正常
NSNumberFormatter *formatter = [NSNumberFormatter new];
[formatter setNumberStyle:NSNumberFormatterDecimalStyle]; // this line is important!
NSString *formatted = [formatter stringFromNumber:[NSNumber numberWithFloat:appDelegate.C_WND_ClinInf_Average_Default]];
Run Code Online (Sandbox Code Playgroud)
但它显示1,947但我希望它显示1,947.00任何想法如何形成这样的.
谢谢
当我尝试从我的应用程序中的设置辅助功能实现用户选择的文本字体时,无法将用户选择的文本大小输入到我的应用程序中.代码就像
let contentSize = UIApplication.sharedApplication().preferredContentSizeCategory
Run Code Online (Sandbox Code Playgroud)
即使在更改设置/可访问性后,preferredContentSizeCategory也始终返回与UICTContentSizeCategoryL相同的字体
ios ×9
objective-c ×3
iphone ×2
swift ×2
android ×1
camera ×1
dng ×1
dynamic-text ×1
google-login ×1
image ×1
java ×1
mobile ×1
numbers ×1
row ×1
shrink ×1
swift3 ×1
tableview ×1
uikit ×1
uitableview ×1
wkwebview ×1