タイマーを実装しようとしていますが、アクセスが悪いです...私はリリースもdeallocでも使用しませんでした。
.h
NSTimer *_timerAnimacao;
@property (nonatomic, retain) NSTimer *timerAnimacao;
.m
@synthesize timerAnimacao = _timerAnimacao;
ここでタイマーを呼び出します。
if(acondition)
_timerAnimacao = [NSTimer scheduledTimerWithTimeInterval:0.06 target:self selector:@selector(changeTimeFilter:) userInfo:nil repeats:YES];
else
_timerAnimacao = [NSTimer scheduledTimerWithTimeInterval:0.06 target:self selector:@selector(changeTimeFilterHide:) userInfo:nil repeats:YES];
正常にchangeTimeFilter
動作します...しかし、 BAD AccesschangeTimeFilterHide
を取得しています。
-(void)changeTimeFilter:(NSTimer *)theTimer{
if (tAnimacaoFilter<5) {
[_tbFilters setFrame:CGRectMake(_tbFilters.frame.origin.x, _tbFilters.frame.origin.y, _tbFilters.frame.size.width, 58*tAnimacaoFilter)];
}
if(tAnimacaoFilter < 10) {
tAnimacaoFilter++;
[_tbFeeds setFrame:CGRectMake(_tbFeeds.frame.origin.x, _tbFeeds.frame.origin.y + (4.4*tAnimacaoFilter), _tbFeeds.frame.size.width, _tbFeeds.frame.size.height - (4.4*tAnimacaoFilter))];
[imgBordaTbDireita setFrame:CGRectMake(imgBordaTbDireita.frame.origin.x, _tbFeeds.frame.origin.y - 4, imgBordaTbDireita.frame.size.width, imgBordaTbDireita.frame.size.height)];
[imgBordaTbEsquerda setFrame:CGRectMake(imgBordaTbEsquerda.frame.origin.x, _tbFeeds.frame.origin.y, imgBordaTbEsquerda.frame.size.width, imgBordaTbEsquerda.frame.size.height)];
}
else {
if(_timerAnimacao)
[_timerAnimacao invalidate];
[btnFilter setEnabled:YES];
}
}
-(void)changeTimeFilterHide:(NSTimer *)theTimer{
if (tAnimacaoFilter<5) {
[_tbFilters setFrame:CGRectMake(_tbFilters.frame.origin.x, _tbFilters.frame.origin.y, _tbFilters.frame.size.width, (58*5) - (58*tAnimacaoFilter))];
}
if(tAnimacaoFilter < 10) {
tAnimacaoFilter++;
[_tbFeeds setFrame:CGRectMake(_tbFeeds.frame.origin.x, _tbFeeds.frame.origin.y - (4.4*tAnimacaoFilter), _tbFeeds.frame.size.width, _tbFeeds.frame.size.height + (4.4*tAnimacaoFilter))];
[imgBordaTbDireita setFrame:CGRectMake(imgBordaTbDireita.frame.origin.x, _tbFeeds.frame.origin.y - 4, imgBordaTbDireita.frame.size.width, imgBordaTbDireita.frame.size.height)];
[imgBordaTbEsquerda setFrame:CGRectMake(imgBordaTbEsquerda.frame.origin.x, _tbFeeds.frame.origin.y, imgBordaTbEsquerda.frame.size.width, imgBordaTbEsquerda.frame.size.height)];
}
else {
if(_timerAnimacao)
[_timerAnimacao invalidate];
[btnFilter setEnabled:YES];
}
}