Man*_*wal 2 iphone xcode uiactionsheet ios
我想在操作表上设置操作,以便当用户点击操作表的上方时,它会被解雇.
我想要这个,因为我不想在动作表中添加取消按钮.用户可以通过点击休息区视图来取消操作表,而不是取消按钮.
任何建议如何在iPhone中执行此操作.
谢谢
// For detecting taps outside of the alert view
-(void)tapOut:(UIGestureRecognizer *)gestureRecognizer
{
CGPoint p = [gestureRecognizer locationInView:self];
if (p.y < 0)
{ // They tapped outside
[self dismissWithClickedButtonIndex:0 animated:YES];
}
}
-(void) showFromTabBar:(UITabBar *)view
{
[super showFromTabBar:view];
// Capture taps outside the bounds of this alert view
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapOut:)];
tap.cancelsTouchesInView = NO; // So that legit taps on the table bubble up to the tableview
[self.superview addGestureRecognizer:tap];
[tap release];
}
Run Code Online (Sandbox Code Playgroud)
看到这里.
请注意,这已经发生在iPad上.
| 归档时间: |
|
| 查看次数: |
3220 次 |
| 最近记录: |