iCarousel项目捏和平底锅

时间:2016-11-02 09:41:30

标签: ios objective-c zoom uigesturerecognizer icarousel

我正在尝试为list_of_word = [word1, word2, word3, word1] 项目视图实现缩放功能。这是我的代码:

from nltk.corpus import wordnet as wn
from itertools import product

def similarity(wordx,wordy):
    sem1, sem2= wn.synsets(wordx), wn.synsets(wordy)
    maxscore = 0
    for i,j in list(product(*[sem1,sem2])):
        score = i.path_similarity(j) # Wu-Palmer Similarity
        maxscore = score if maxscore < score else maxscore
    return maxscore

def group_high_similarity(target_list,tc):
    result = target_list[:]
    num_word = len(result)
    for word in result:
        wordx = word
        i = 0
        while i<len(result):
            wordy = result[i]
            value = similarity(wordx,wordy)
            if  value >= tc:
                result[i] = wordx
                if wordy != wordx :print wordy+"---> "+ wordx 
            i += 1
    return result

问题是我的iCarouselNSString *pathToHDImage = [documentsFolderPath stringByAppendingPathComponent:solution.localHDURL]; if (!view) { view = [[AsyncImageView alloc] initWithFrame:self.view.bounds]; view.contentMode = UIViewContentModeScaleAspectFit; UIPinchGestureRecognizer *pinchGesture = [[UIPinchGestureRecognizer alloc] initWithTarget:self action:@selector(handlePinch:)]; pinchGesture.cancelsTouchesInView = false; UIPanGestureRecognizer *panGesture = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(handlePan:)]; panGesture.cancelsTouchesInView = false; pinchGesture.delegate = panGesture.delegate = self; [view addGestureRecognizer:pinchGesture]; [view addGestureRecognizer:panGesture]; ((AsyncImageView *)view).imageURL = [NSURL fileURLWithPath:pathToHDImage]; } else ((AsyncImageView *)view).imageURL = [NSURL fileURLWithPath:pathToHDImage]; 永远不会被调用。我能怎么做?主要目标是为每个handlePan:项目视图实现缩放功能。

1 个答案:

答案 0 :(得分:0)

试用此代码:

 - (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer
    {
    return YES;
    }

我没有测试,但我希望它有所帮助。 如果它不起作用,请查看此link1,然后查看此link2