是否有一种简单的方法来禁用UITextField代码?
我的应用程序有12个UITextField默认情况下全部打开,但是当我的细分控制中检测到更改时,我想禁用其中一些,UITextField具体取决于用户选择的细分.
只需要知道如何禁用它或使其不可编辑?
谢谢
我正在使用S3 bucket从我的swift项目上传图像,然而,我的上传暂停,并在控制台中给我以下警告.但是,我不确定为什么,但上传似乎自动重启,第二次几乎总是成功.之后的任何上传通常都很好.(只有当我暂时没有与服务器交互时
AWSiOSSDK v2.4.7 [Error] AWSURLSessionManager.m line:212 | -[AWSURLSessionManager URLSession:task:didCompleteWithError:] | Session task failed with error: Error Domain=NSURLErrorDomain Code=-1001 "The request timed out." UserInfo={NSUnderlyingError=0x13eba2b50 {Error Domain=kCFErrorDomainCFNetwork Code=-1001 "(null)" UserInfo={_kCFStreamErrorCodeKey=-2102, _kCFStreamErrorDomainKey=4}}, NSErrorFailingURLStringKey=https://s3.amazonaws.com/myBucketName/filename.jpg, NSErrorFailingURLKey=https://s3.amazonaws.com/myBucketName/filename.jpg, _kCFStreamErrorDomainKey=4, _kCFStreamErrorCodeKey=-2102, NSLocalizedDescription=The request timed out.}
Run Code Online (Sandbox Code Playgroud)
下面是我如何将文件发送到S3
// 2. Create upload request
let uploadRequest = AWSS3TransferManagerUploadRequest()
uploadRequest.bucket = "myBucket"
uploadRequest.key = "FileName.jpg"
uploadRequest.ACL = AWSS3ObjectCannedACL.PublicRead
uploadRequest.contentType = "image/jpg"
uploadRequest.body = url
// Track progress through an AWSNetworkingUploadProgressBlock
uploadRequest?.uploadProgress = {[weak self](bytesSent:Int64, totalBytesSent:Int64, totalBytesExpectedToSend:Int64) in …Run Code Online (Sandbox Code Playgroud) 我是iOS App Development的新手.
在我的应用程序中,我尝试使用导航栏后退按钮从第二个视图导航到第一个视图,但是在视图中拖放导航栏我只能获得带标题的栏.
我真的很担心,我不确定我做错了什么?我正在使用Xcode 4.3.和故事板来设计视图.
我现在得到了什么

寻找

谢谢你的帮助
我希望你们都安全。
我知道这个问题被问了好几次,但没有得到完美的答案。
我只是想从 UIView 中捕获高分辨率的图像,主要是图像不应该是模糊的。
我已经尝试过这段代码
extension UIView {
func asImage() -> UIImage {
let renderer = UIGraphicsImageRenderer(size: self.bounds.size)
let capturedImage = renderer.image {
(ctx) in
self.drawHierarchy(in: self.bounds, afterScreenUpdates: true)
}
return capturedImage
}
}
Run Code Online (Sandbox Code Playgroud)
现在,当我捕获图像并缩放时,文本变得模糊。
提前致谢
编辑 我正在尝试从 UIView 创建高分辨率图像。当我缩放图像的 1 部分时,文本变得模糊。
请检查下图
let url = "http://xyz/index_main.php?c=webservices&a=get&e=007"
Alamofire.request(url, method: .post, parameters: nil, encoding: JSONEncoding.default)
.responseJSON { response in
print(response)
//to get status code
if let status = response.response?.statusCode {
switch(status){
case 201:
print("example success")
default:
print("error with response status: \(status)")
}
}
//to get JSON return value
if let result = response.result.value {
let JSON = result as! NSDictionary
print(JSON)
}
Run Code Online (Sandbox Code Playgroud)
结果:
{
"create_by" = 007;
"create_date" = "2016/06/20";
"due_date" = "2016/06/22";
"estimate_time" = "";
fixer = 007;
priority = High;
"project_code" = …Run Code Online (Sandbox Code Playgroud) 这个问题再问一次,但我找不到ios 10
if UIImagePickerController.isSourceTypeAvailable(UIImagePickerControllerSourceType.camera)
{
self.imagePicker.delegate = self
self.imagePicker.sourceType = UIImagePickerControllerSourceType.camera;
self.imagePicker.allowsEditing = false
self.imagePicker.cameraCaptureMode = .photo
//self.imagePicker.modalPresentationStyle = UIModalPresentationStyle.overCurrentContext
self.present(self.imagePicker, animated: true, completion: nil)
self.imagePicked.isUserInteractionEnabled = true
}
else
{
print("No Camera")
}
Run Code Online (Sandbox Code Playgroud)
对未渲染的视图进行快照会导致快照为空。请确保在快照之前至少对视图进行一次渲染或在屏幕更新后进行快照。
当我旋转相机拍摄照片时,会发生此错误。
我知道这个问题重复,但我不能得到嘘声
我有这个形象
我想要这样的视图背景
我已经尝试了所有这一切
我也试试这个
self.view.backgroundColor = UIColor(patternImage:
UIImage(named: "backgroundicon.png")!)
Run Code Online (Sandbox Code Playgroud)
先感谢您
编辑:
UIGraphicsBeginImageContext(self.view.frame.size)
UIImage(named: "backgroundicon.png")?.draw(in: self.view.bounds)
let image: UIImage = UIGraphicsGetImageFromCurrentImageContext()!
UIGraphicsEndImageContext()
self.view.backgroundColor = UIColor(patternImage: image)
Run Code Online (Sandbox Code Playgroud)
结果:
我有一个UITableView在第一次调用时加载其数组项目.但是,当我刷新tableview时它会崩溃,因为委托方法cellForRowAtIndexPath被提前调用.我有一个整数,表示我的主数据数组的索引,并在我的刷新按钮中重置为0.然而它崩溃是因为它试图在重置之前重新加载数据.我通常会使用indexPath.row作为我的索引,但是数组很复杂,而indexPath.row与我想要为每个单元格显示的内容不匹配.下面是一些代码,任何帮助表示赞赏.
当我下拉刷新AND viewDidLoad以准备数据时,会调用此方法
- (IBAction)refresh:(id)sender {
itemIndexer = 0;
[sender beginRefreshing];
[self loadData];
}
Run Code Online (Sandbox Code Playgroud)
我的loadData方法的一部分
-(void) loadData {
dispatch_queue_t backgroundQueue = dispatch_queue_create("com.Foo.myqueue", 0);
dispatch_queue_t mainQueue = dispatch_get_main_queue();
dispatch_async(backgroundQueue, ^{
[self downloadData];
dispatch_async(mainQueue, ^{
[self.tableView reloadData];
[_rcRefresh endRefreshing];
});
});
Run Code Online (Sandbox Code Playgroud)
在viewDidLoad中我调用最初加载tableview:
[self refresh:_rcRefresh];
Run Code Online (Sandbox Code Playgroud)
我得到一个超出数组错误范围的索引.我使用断点来确定原因,原因很简单,因为刷新没有被调用,否则itemIndexer将被设置为0.而不是它的数字大于数组1.如果它真的有必要我可以发布cellForRowAtIndexPath但是我不确定你是否需要它,如果它在第一次调用时工作.因此,总结对tableview的第一次调用是有效的,并且数据加载正常,但刷新会导致索引超出数组的边界,就像从不调用refresh:一样.
ios ×7
swift ×3
swift3 ×2
alamofire ×1
amazon-s3 ×1
arrays ×1
camera ×1
image ×1
ios10 ×1
iphone ×1
json ×1
nsarray ×1
objective-c ×1
resolution ×1
swift5 ×1
uiimageview ×1
uitableview ×1
uitextfield ×1
view ×1
xcode4 ×1
xcode4.3 ×1