首页 \ 问答 \ 如何排序UIImage在ios中以降序添加NSMutableArray(How to sort UIImage added NSMutableArray in ios in descending)

如何排序UIImage在ios中以降序添加NSMutableArray(How to sort UIImage added NSMutableArray in ios in descending)

我正在为存储到NSMutableArray的UIImage工作。 我如何使用UIImage对其进行排序,因为它不存储任何参数或for-key,我可以使用任何比较器代码对其进行排序。

我正在努力从图像选择器控制器存储UIImage。 将数量的图像存储到NSMutableArray之后。 之后,我需要将My mutable排序为Last In First out(LIFO)。 它目前以先进先出(FIFO)或降序运行。 我们将图像存储到数组如下:

NSMutableArray *images = [NSMutableArray arrayWithCapacity:[info count]];

    for (NSDictionary *dict in info) {

        UIImage *image = [dict objectForKey:UIImagePickerControllerOriginalImage];
        [images addObject:image];

    }


    [_currentData addObjectsFromArray:images];

存储后我无法将上次添加的对象排序为图像视图中的第一个显示。 以下代码崩溃对我来说:

NSSortDescriptor *desc = [NSSortDescriptor sortDescriptorWithKey:@"" ascending:NO];
    [_currentData sortUsingDescriptors:@[desc]];

我的_currentData是主要的NSMutableArray,我用它在短路后显示在表视图中。

请帮助我排序UIImage存储的NSMutableArray为LAST IN FIRST OUT(LIFO)降序。


I am working for UIImage storing to NSMutableArray. How i can sort it with the UIImage because it's not storing any parameter or for-key by which i can sort using any comparator code.

I am working to store UIImage from image picker controller. After storing numbers of images to NSMutableArray. After that i need to sort My mutable to Last In First out(LIFO). It's currently working as First In First Out(FIFO) or descending. We are storing images to array as follow:

NSMutableArray *images = [NSMutableArray arrayWithCapacity:[info count]];

    for (NSDictionary *dict in info) {

        UIImage *image = [dict objectForKey:UIImagePickerControllerOriginalImage];
        [images addObject:image];

    }


    [_currentData addObjectsFromArray:images];

After Storing i am not able to Sort Last added object to First display in image view. Following code Crashes for me:

NSSortDescriptor *desc = [NSSortDescriptor sortDescriptorWithKey:@"" ascending:NO];
    [_currentData sortUsingDescriptors:@[desc]];

My _currentData is main NSMutableArray which i am using to display in the table view after shorting.

Please help me For sorting UIImage stored NSMutableArray for LAST IN FIRST OUT(LIFO) descending order.


原文:
更新时间:2022-06-19 12:06

最满意答案

作为基本过滤器,您可以使用OnHTTPBeforeCommand事件处理程序(在将命令发送到HTTP服务器之前触发)。

检查Context参数属性,你会发现有用的:

Context.Command
Context.OutboundClient.Host
Context.OutboundClient.Port
Context.Document
Context.Headers

我此时从未试图阻止PassTrough,但我敢打赌,如果您确定存在阻止规则匹配,则可以通过在此时引发异常来实现。


As a basic filter you can use the OnHTTPBeforeCommand event handler (which fires before the command is sent to the HTTP server).

Inspect the Context parameter properties, you'll find useful:

Context.Command
Context.OutboundClient.Host
Context.OutboundClient.Port
Context.Document
Context.Headers

I never tried to stop the PassTrough at this time, but I bet you can do it by just raising an exception at that point if you determine there's a block rule match.

相关问答

更多
  • 诀窍是在服务器的FakeXMLHttpRequest对象上使用过滤器。 然后,只有您过滤掉的请求才会使用假服务器: server = sinon.fakeServer.create(); server.xhr.useFilters = true; server.xhr.addFilter(function(method, url) { //whenever the this returns true the request will not faked return !url.match(/exa ...
  • Indy没有SNMP服务器组件。 要允许应用程序从您的应用程序请求SNMP值,您必须实现自己的SNMP服务器,例如使用TIdUDPServer及其OnUDPRead事件,然后手动解析SNMP请求。 另一个选择是让外部应用程序在您的应用程序中注册自己,然后您的应用程序可以使用TIdSNMP.SendTrap()在需要时将状态更新推送到已注册的应用程序。 Indy does not have an SNMP server component. To allow apps to request SNMP valu ...
  • 我相信你不应该使用pin-holing - http://www.indyproject.org/docsite/html/TIdConnectThroughHttpProxy.html CONNECT命令不是WWW的工作方式。 没有浏览器使用它。 这是非WWW程序试图突破防火墙并开放直接访问WWW之外的所有互联网领域的方式。 不要使用“透明代理”类。 使用常规HTTP代理,例如如何使用Indy 10和OpenSSL通过HTTPS下载文件? 顺便说一句,没有这样的事件处理程序,因为你的名字是“HTTPBef ...
  • 2016年12月:似乎没有 2017年2月更新:已批准的状态现在是搜索条件的一部分。 审核者已批准的过滤请求: state:open type:pr review:approved 您可以根据问题状态或拉取请求进行搜索 : 您可以根据审核状态( none , required , approved , changes requested或required ),审核人员和请求的审核者过滤提取请求。 类型:pr review:approved :将匹配评论者已批准的拉取请求。 请参阅“ 过滤拉取请求审核和审核请 ...
  • 您可以通过从管理面板创建过滤器来过滤掉它。 1转到“管理”选项卡。 2在“查看列”下,选择过滤器,然后单击+添加过滤器添加过滤器按钮Google Anlaytics 3输入名称。 4过滤器类型:自定义和排除 5过滤字段:选择广告系列来源并输入网址 此博客是一个非常全面的过滤垃圾邮件的指南。 You can filter it out by creating a filter from the admin panel. 1 Go to the Admin tab. 2 Under the "View colu ...
  • 我试过这个代码,这对我来说很好 FB.ui( { method: 'apprequests', filters: ['app_non_users'], message: 'msg here!', title: 'title for box' }, function(response) { alert( ...
  • 您的代码不会写一个空行来终止您要发送的HTTP标头。 在OnBeforeCommand事件处理程序退出后,您还需要抛出异常以防止TIdHTTPProxyServer导航到客户端请求的URL。 尝试这个: void __fastcall TForm3::MyProxyHTTPBeforeCommand(TIdHTTPProxyServerContext *AContext) { if (AContext->Target == "http://xxx.com/need_redirect_url" ) ...
  • 如果连接到您的TIdHTTPProxyServer的HTTP客户端请求.i2p主机名(并且可能是SwitchProxy()在返回3时查找的那个),则OutboundClient.IOHandler将请求TIdConnectThroughHttpProxy与运行的HTTP代理建立套接字连接在127.0.0.1:4444并向其发送命令以从HTTP客户端的原始.i2p请求连接到主机名和端口。 然后,HTTP代理必须使用DNS将.i2p主机名解析为IP,然后才能与该主机建立套接字连接并返回对TIdConnectTh ...
  • 控制台选项卡上有一个小箭头,您可以关闭它在那里显示的内容。 There is a small arrow on the console tab, you can turn off what it displays there.
  • 作为基本过滤器,您可以使用OnHTTPBeforeCommand事件处理程序(在将命令发送到HTTP服务器之前触发)。 检查Context参数属性,你会发现有用的: Context.Command Context.OutboundClient.Host Context.OutboundClient.Port Context.Document Context.Headers 我此时从未试图阻止PassTrough,但我敢打赌,如果您确定存在阻止规则匹配,则可以通过在此时引发异常来实现。 As a basic ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)