2011-05-09 6 views
1

안녕하세요 저는 제 프랑스어 때문에 제게 영어를 가르칩니다. 제 질문은 여기에 있습니다. 어떻게 높이와 너비를 정의 할 수 있습니까? 여기에 그 이름은 flakeView입니다. xPosition과 yPosition은 왼쪽 상단, 중앙이 아닌 것을xcode보기의 높이와 너비를 정의하는 방법

UIImageView* flakeView = [[[UIImageView alloc] initWithImage:flakeImage] autorelease]; 

// use the random() function to randomize up our flake attributes 
int startY = round(random() % 320); 

// set the flake start position 
flakeView.center = CGPointMake(490, startY); 
flakeView.alpha = 1; 

// put the flake in our main view 
[self.view addSubview:flakeView]; 

[UIView animateWithDuration:7 
       animations:^{ 
        // set the postion where flake will move to 
        flakeView.center = viewToRotate.center; 
       }]; 

답변

7
CGRect frame = CGRectMake(xPosition, yPosition, width, height); 
flakeView.frame = frame; 

참고 : 여기에 코드입니다.

관련 문제