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时。我要做的就是单击UIImageView时显示一个弹出窗口,它显示在UIImageView的右侧。我看到UIImageView没有它的addAction属性,因为它不是UIControl的子类。我做了一些研究,可能不得不改用UIButton。这是真的?有没有一种方法可以使用UIImageView做到这一点,所以我不必再次重写代码?一世
没有找到相关结果
已邀请:
4 个回复
骇毖煽洁铂
的对象。 如果您在Apple文档中看到UIImageView。
UIResponder具有获取触摸的功能。因此,在您的视图类中实现以下功能,并检测ѭ3上的触摸。
第二: 您也可以为
创建
。 查看以下博客教程。 使用UIGestureRecognizers 编辑: 使用以下代码:
如果用户点击一次,则将调用轻按的函数,因此选项卡式的函数应如下所示
恋裂
驮帽俺篮号
厘恼轨
现在
与您的
非常相似 由于您在谈论弹出式控制器,因此我假设您已经有手势识别器。