0
執行幻燈片方法後,調用該方法後UIView上的按鈕停止工作。動畫後按鈕停止功能iOS
有關可能發生什麼的任何想法?
@implementation ResultSliderView
- (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
// Initialization code
self.frame = CGRectMake(10,255,0,0);
}
return self;
}
/*
This method slides the view up by animating
*/
-(void)slideUp{
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:.5];
[UIView setAnimationCurve:UIViewAnimationOptionAllowUserInteraction];
self.frame = CGRectMake(5,38,0,0);
[UIView commitAnimations];
}
天才。你有沒有機會知道如何讓用戶拖拽視圖而不是自己設置?所以就像一個滑塊,如果我拖動,它會跟隨,但如果我走了一半以上,放手,它會對齊頂部,否則底部? – 2013-03-23 19:29:15
@waf,要做到這一點,您需要將一個平移手勢識別器附加到視圖中,並使用其translationInView屬性更改框架以跟蹤移動。 – rdelmar 2013-03-23 20:37:22