如何在 UILabel 中显示 NSArray 并使用计时器
我正在尝试使用计时器在 UILabel 中显示数字数组,并按数组中设置的顺序显示它们,但我只收到格式的标题,然后收到 SIGABRT ! 任何建议...谢谢
部分代码有问题!
-(IBAction) rotate3
{
NSString *number = [dayArray initWithArray:(NSArray *)dayArray];
NSArray *array = [[NSArray alloc] initWithObjects: @"0", @"1", @"2", @"3", @"4", @"5" ,@"6", @"7", @"8",@"9",@"10",@"11",@"12",@"13", @"14", @"15", @"16", @"17", @"18", @"19",nil];
numberCount++;
timer=[NSTimer scheduledTimerWithTimeInterval:5.0 target:self selector:@selector(rotate3 )userInfo:nil repeats:YES];
self.dayArray = array;
[array release];
label.text = [[NSString alloc] initWithFormat:@"Day %@ " number];
}
I'm trying to display an array of numbers in a UILabel using a timer,and show them in the order set in the array, but I only receive the Title in the format and then a SIGABRT !
any suggestions...Thanks
Part of the code with problems!
-(IBAction) rotate3
{
NSString *number = [dayArray initWithArray:(NSArray *)dayArray];
NSArray *array = [[NSArray alloc] initWithObjects: @"0", @"1", @"2", @"3", @"4", @"5" ,@"6", @"7", @"8",@"9",@"10",@"11",@"12",@"13", @"14", @"15", @"16", @"17", @"18", @"19",nil];
numberCount++;
timer=[NSTimer scheduledTimerWithTimeInterval:5.0 target:self selector:@selector(rotate3 )userInfo:nil repeats:YES];
self.dayArray = array;
[array release];
label.text = [[NSString alloc] initWithFormat:@"Day %@ " number];
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这是一个非常奇怪的字符串:
[dayArray initWithArray:(NSArray *)dayArray];
。试试这个:It is very strange string :
[dayArray initWithArray:(NSArray *)dayArray];
. Try this:您的 SIGABRT 可能是由于堆栈损坏: NSTimer 只能与以下形式的选择器一起使用:
但您尝试将其与
没有足够参数的选择器一起使用。
Your SIGABRT is probably due to stack corruption: NSTimer can only be used with selectors of the form:
but you're trying to use it with
which doesn't take enough arguments.