轻触scrollview中的imageview时放大图像

时间:2015-07-02 15:10:19

标签: ios objective-c uiimageview

我有一个实现水平图库的应用。我能够显示图像缩略图。现在我需要做的是在拍摄时放大图像。我正在使用EMNotificationPopup来显示放大的图像。这就是我到目前为止所拥有的:

此代码段位于我的viewdidload中:

UITapGestureRecognizer *singleTap;
UIImageView * imageview; 

singleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleImageTap:)];
[singleTap setNumberOfTouchesRequired:1];
[singleTap setNumberOfTapsRequired:1];
singleTap.delegate = self;

[imageview setUserInteractionEnabled:YES];
[imageview addGestureRecognizer:singleTap];

- (void) handleImageTap:(UIGestureRecognizer *)gestureRecognizer {
    [self coreManagementWithPosition:EMNotificationPopupPositionCenter andType:EMNotificationPopupBig];
}

- (void) coreManagementWithPosition: (EMNotificationPopupPosition) position andType:(EMNotificationPopupType) notificationPopupType {
    if (_notificationPopup.isVisible) {
        [_notificationPopup dismissWithAnimation:YES];
        _notificationPopup = NULL;
    } else {
        _notificationPopup = [[EMNotificationPopup alloc] initWithType:notificationPopupType enterDirection:EMNotificationPopupToDown exitDirection:EMNotificationPopupToLeft popupPosition:position];
        _notificationPopup.delegate = self;

        _notificationPopup.title = @"Sorry for this Alert message :)";
        _notificationPopup.subtitle = @"Awesome message :)";
        _notificationPopup.image = [UIImage imageNamed:@"alert_image"];

        if (notificationPopupType == EMNotificationPopupBigButton)
            _notificationPopup.actionTitle = @"OK";

        [_notificationPopup show];
    }
}

我的问题是 handleImageTap 未初始化/调用。如何为imageview启用用户交互。

0 个答案:

没有答案