如何確定控件是否位於iOS的顯示區域內?如何確定控件是否位於顯示區域
例如
有一個UILabel
,它會從屏幕右側滑到左邊,直到它從屏幕上滑到邊界的左邊,我如何確定它是否已經滑出邊界?
我使用動畫塊模型。當動畫完成時,我們可以確定Label已經超過了0;
現在我想刪除標籤。
例如
[UIView animateWithDuration:5.5
delay:0.1
options: UIViewAnimationOptionCurveLinear | UIViewAnimationOptionRepeat
animations:^
{
[UIView setAnimationRepeatCount:3];
CGRect lsframe = labelShow.frame;
lsframe.origin.x = 0;
lsframe.origin.y = dphv.mImgContent.frame.origin.y;
lsframe.size.width = 8;
lsframe.size.height = imgH;
CGRect frame = labelShow.frame;
frame.origin.x = 600;
labelShow.frame = frame;
frame = labelShow.frame;
frame.origin.x = -180;
labelShow.frame = frame;
}
completion:^(BOOL finished)
{
NSLog(@"animation finished");
labelShow = nil; //but this line has error, how can I do this;
}];
我用這個例子,但這個例子有一個非常嚴重的問題,導致內存了,甚至超過100m,但我不知道如何解決改革。這是網址:https://github.com/yinkou/OBaconView