мультитач и кнопки в том же виде - PullRequest
0 голосов
/ 14 февраля 2012

Привет, у меня есть приложение UIViewController, которое поддерживает мультитач и также имеет несколько кнопок, мне нужно, чтобы при двойном щелчке по кнопке пользователь открывал новый вид, а когда пользователь двигал пальцем по экрану, он открывал другой вид.

Приложение работает нормально, если пользователь кладет палец в область, где нет кнопок, но если он кладет пальцы в область, где есть кнопки, ничего не происходит

- (void)viewDidLoad
{
    [super viewDidLoad];
 button = [UIButton buttonWithType:UIButtonTypeCustom];
            [button addTarget:self 
                       action:@selector(openPic:)
             forControlEvents:UIControlEventTouchDownRepeat];
            button.tag = image;
            button.frame = CGRectMake(orInc, inc,  70.0, 95.0);
            [self.view addSubview:button];
]


-(void) openPic:(id)sender  {
    UINavigationController *nav=[[UINavigationController alloc]init];
    PicController *x=[[PicController alloc]init];
    nav.viewControllers=[NSArray arrayWithObject:x];
    [self.navigationController pushViewController:x animated:YES];
}

- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {

    UINavigationController *nav=[[UINavigationController alloc]init];
    ViewController *x=[[ViewController alloc]init];
    nav.viewControllers=[NSArray arrayWithObject:x];
    [self.navigationController pushViewController:x animated:YES];
}

1 Ответ

0 голосов
/ 14 февраля 2012

Установите userInteractionEnabled свойство объекта UIButton на NO и попробуйте его.

...