首页 \ 问答 \ 带参数的选择器(Selector with argument)

带参数的选择器(Selector with argument)

我有这样的方法:


- (void)methodWithParameter:(id)parameter {

}

我想用UIBarButtonItem来调用它

barButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAction target:self action:@selector(methodWithParameter:)];
我想指定参数,但我不能使用withObject:action后:因为我收到警告:

否-initWithBarButtonSystemItem:target:action:withObject:找到的方法

任何人都可以帮我吗?


I have a method like this:


- (void)methodWithParameter:(id)parameter {

}

and I want to call it using an UIBarButtonItem

barButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAction target:self action:@selector(methodWithParameter:)];
I want to specify the parameter but I can't use withObject: after action: because I get a warning:

No -initWithBarButtonSystemItem:target:action:withObject: method found

can anybody help me with this?


原文:https://stackoverflow.com/questions/4838515
更新时间:2024-04-13 10:04

最满意答案

由于100个元素的大小,过程非常快,您甚至不会发现任何差异。

所以你想要哪种方式。

但是,如果您正在查看数组中的大量项目,我会说第二个选项更快。 因为基数排序使用辅助缓冲区来存储部分排序结果。 这增加了该算法所需的内存。 在处理大量元素时,它会有很大的不同。


With the size of 100 elements, the process is so quick that you won't even recognise any differences.

So which ever way you want.

However, if you are looking at a larger number of items in an array, I would say the second option is faster. Because radix sort uses a secondary buffer to store partial sorting results. This increase the memory required for this algorithm. It makes a big different when dealing with big number of elements.

相关问答

更多

相关文章

更多

最新问答

更多
  • Firebird客户端安装(Firebird client installation)
  • 如何检查一个文件是否已被C中的另一个进程打开?(How to check if a file is already open by another process in C?)
  • 将对象引用存储在控件标签属性确定中(Is storing an object reference in a controls Tag property OK)
  • 谁能介绍《商务谈判》课程的高职高专教材???谢谢!!!
  • 递归图像下载与请求(recursive image download with requests)
  • C ++对齐字符以便在任何实现的输入中整齐地显示(C++ aligning characters to display neatly with any input implemented)
  • 根据字段值插入一行(Insert a row, based on a fields value)
  • 在Ubuntu上使用TCP_REPAIR套接字选项编译代码[关闭](Compiling code with TCP_REPAIR socket option on Ubuntu [closed])
  • 在开发React应用程序时编译/转换代码(Compile/transpile code while developing React app)
  • 重庆软件开发培训 Java培训哪好
  • 将MultiPoint序列化为GeoJSON文件(Serialize MultiPoint to GeoJSON file)
  • 将文本从多个文件,相同的名称复制到bash(linux)中的不同路径(Copy text from multiple files, same names to different path in bash (linux))
  • 将字符串截断为特定数量的字符,忽略HTML(Truncate string to certain amount of characters, ignoring HTML)
  • 如何为崩溃的JNI调用编写JUnit测试?(How can I write a JUnit test for a JNI call that crashes?)
  • 多点触摸两个手指轻拍(Multi-touch two fingers taps)
  • Sqlserver监视时间的变化(Sqlserver watch for time change)
  • Srcset属性 - 最大宽度问题(Srcset attribute - max-width issue)
  • 如何验证数据库中是否存在记录?(How to verify existence of a record in database?)
  • SQL JOIN来自不同表的行具有相同的值(SQL JOIN row from different table with the same values)
  • NSTextField - 使用KVO进行输入验证?(NSTextField - Input validation with KVO?)
  • 如何使用DBPedia从根类别中提取不同级别的子类别?(How to extract sub-categories of different levels from a root category using DBPedia?)
  • 在Javascript中,如何检查数组是否有重复值?(In Javascript, how do I check if an array has duplicate values? [duplicate])
  • 有什么区别:焦点:必需:无效:焦点和:焦点:必需:无效?(What's the difference between :focus:required:invalid:focus and :focus:required:invalid?)
  • 使用OData创建新数据(Creating new data with OData)
  • 获取过滤器从spark数据帧中删除的行的示例(Get examples for rows that are removed by a filter from a spark dataframe)
  • 使用@RequestMapping编码到Spring Controller方法的接口(Coding to an interface on a Spring Controller method with @RequestMapping)
  • 如果Shape在屏幕外,是否执行Graphics2D.draw?(Is Graphics2D.draw performed if the Shape is offscreen?)
  • 与ajax的成功(success with ajax)
  • 如何获取在Javascript中单击的文本?(How can I get the text that was clicked on in Javascript?)
  • 如果没有头文件,如何定义静态成员?(How to define a static member in case there is not header file?)