2012-06-15 3 views
2

내 프로그램에서는 두 개의 임의 지점 사이에서 25 개의 이미지 중 5 개의 이미지를 이동해야합니다. 슈퍼 클래스를 가진 클래스에서 이미지 뷰를 생성하는 중입니다. UIImageView입니다. 각 이미지를 식별하기 위해 태그 또는 다른 매개 변수를 사용하여 이미지보기를 생성하려면 어떻게해야합니까? 어느 누구도 샘플 코드 나 유용한 자습서를 제공 할 수 있습니까?25 개 이미지 중에서 한 포인트에서 다른 포인트로 무작위로 5 개 이미지를 이동하는 방법은 무엇입니까?

+0

더 구체적이고 정교하게 질문 해주세요. – Abhishek

+0

괜찮습니다. – user1458517

답변

0

당신이 generat라는 때 난 당신이 어떤 이미지를 이동할 때 귀하의 세대 지금

UIImageView *imageView = [YourGenerator generateImageView]; 
//Add a tag to it 
imageView.tag = 1; 
[self.view addSubView:imageView]; 
//Add another image 
imageView = [YourGenerator generateImageView]; 
//Add a tag to it 
//Different tag 
imageView.tag = 2; 
[self.view addSubView:imageView]; 

유사하다 assue 예를 들어 UIImageView 는 이제 다음

//Get the image view by its tag 
UIImageView *imageView1 = [self.view viewWithTag:1]; 
UIImageView *imageView2 = [self.view viewWithTag:1]; 

을로 이동 당신이 바라는 것