Я хотел бы запустить это событие:UIImageView показывая UIPopOver
- (IBAction)profilePop:(id)sender
{
ProfileViewController * profile = [[ProfileViewController alloc] init];
UIImageView * temp = ((UIImageView *)sender);
profile.uid = [[[posts objectAtIndex:((UIImageView *)sender).tag] creator] mid];
NSLog(@"profile id %@", profile.uid);
UIPopoverController * profilePop = [[UIPopoverController alloc] initWithContentViewController:profile];
[profilePop presentPopoverFromRect:CGRectMake(temp.frame.origin.x+temp.frame.size.width, temp.frame.origin.y + temp.frame.size.height/2, profile.view.frame.size.width, profile.view.frame.size.height) inView:self.view permittedArrowDirections:UIPopoverArrowDirectionRight animated:YES];
}
, когда пользователь нажимает на UIImageView. Все, что я пытаюсь сделать, это показать popover при щелчке UIImageView и показано справа от UIImageView. Я вижу, что UIImageView не имеет от него атрибута addAction, поскольку он не является подклассом UIControl. Я сделал некоторые исследования, которые, вероятно, мне, вероятно, придется использовать UIButton. Это правда? Есть ли способ сделать это с помощью UIImageView, поэтому мне не нужно снова переписывать код? I
Можете ли вы быть более конкретным в том, как я могу применить это? – aherlambang
@aherlambang: проверьте обновленный ответ. – Jhaliya
приведет ли это к замедлению, если я добавлю UIGestureRecognizer для каждой ячейки? – aherlambang