2011-04-20 7 views
-1

이미지 뷰를 사각형으로 만들었습니다. 각각은 Object이고 Array입니다. 왼쪽 상단 모서리를 터치하면 이미지 사각형의 가운데가 왼쪽 하단에있게됩니다.동시에 4 개의 NSMutableArray 객체 이동

어떻게하면됩니까?

+1

당신거야 귀하의 질문에 제목이 더 구체적이고 당신의 자세한 내용을 게시 할 경우 더 (더 나은) 응답을 얻을 정확히 당신은 지금까지 관련 샘플 코드를 포함하여 당신이 시도한 것과 시도한 것을 시도하고 있습니다. – XJones

+0

알다시피, 나는 사이버 카페 일을하고 있었고 나는 정말로 빨리 타이핑해야했다. 나는이 질문이 마이너스를 얻을 줄 알았다. :) – DailyDoggy

답변

1

귀하의 질문이 무엇인지 잘 모르겠습니다. 나는 다음과 같은 가정합니다 :

  1. 그리드는 오른쪽 아래 왼쪽 상단에서 주문 gridArray에 저장되어있는 그리드 gridWidth

  2. 객체에 저장되어있는 치수 정사각형을

  3. 그리드의 객체 왼쪽 상단에서 탭이 감지되면 userTappedObject:을 호출합니다.

  4. 'layoutGrid'라는 함수가 있습니다. KS 배열 및 각 개체의 프레임을 설정

예 :

- (void)userTappedObject:(id)tappedObject 
{ 
    NSUInteger indexOfBottomLeft = gridWidth * (gridWidth - 1); 

    // to exchange the tapped object with the object in the bottom left corner 
    NSUInteger indexOfTappedObject = [myMutableArray indexOfObject:tappedObject]; 
    [gridArray exchangeObjectAtIndex:indexOfTappedObject withObjectAtIndex:indexOfBottomLeft]; 

    // to move the tapped object to the bottom left corner, collapsing objects to the left 
    // from the bottom left corner to make room 
    [gridArray removeObject:tappedObject]; 
    [gridArray insertObject:tappedObject atIndex:indexOfBottomLeft]; 

    // layout the grid (this could animate changes if desired) 
    [self layoutGrid]; 
} 
+0

고마워,하지만 내가 찾는게 뭐야 ... 미안해. Il은 당신에게 그것을 + 어쨌든 줄 것입니다 : D – DailyDoggy

관련 문제