我一直在搜索Apple文档,我唯一能找到的关于双击的功能只是返回了点击之间的可接受时间,因为它被认为是双击.
有人可以给我看一个双击事件的例子吗?
我正在使用a NSTimer
来运行动画(现在只是调用它myMethod
).但是,它导致了崩溃.
这是代码:
@implementation SecondViewController
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void) myMethod
{
NSLog(@"Mark Timer Fire");
}
- (void)viewDidLoad
{
[super viewDidLoad];
NSLog(@"We've loaded scan");
[NSTimer scheduledTimerWithTimeInterval:2.0
target:self
selector:@selector(myMethod:)
userInfo:nil
repeats:YES];
animationTimer = [NSTimer scheduledTimerWithTimeInterval: 1.0 target:self selector:@selector(myMethod:) userInfo:nil repeats: YES];
}
Run Code Online (Sandbox Code Playgroud)
这是崩溃期间的输出
- [SecondViewController myMethod:]:无法识别的选择器发送到实例0x4b2ca40 2012-06-21 12:19:53.297 Lie Detector [38912:207] *由于未捕获的异常'NSInvalidArgumentException'终止应用程序,原因:' - [SecondViewController myMethod:] :无法识别的选择器发送到实例0x4b2ca40'
那么我在这里做错了什么?
我有一个Track表和一个Section表.轨道有很多部分.Section通过Section:track_id连接到各自的任务,track_id对应于Track的:id属性.
<% @track = Track.find(params[:id]) %>
<% @sections = Section.find_by_track_id(@track.id) %>
Run Code Online (Sandbox Code Playgroud)
在上面的代码中,我试图找到共享相同的多个部分:track_id属性,但find_by_track_id()仅返回第一个.获得所有这些的最佳方法是什么?
谢谢!
我一直在搜索,发现^ =运算符与运行函数ixor(a,b,)相同.然而,这会返回a和b的总和,那么^ =与+ =不同?
谢谢!
objective-c ×2
activerecord ×1
cocoa ×1
ios ×1
macos ×1
mouseevent ×1
nsevent ×1
nstimer ×1
python ×1
ruby ×1
selector ×1