xcode how to define the height and width of a view
HI everyone I'm french so scuse me for my english SO here is my question: How can we define the height and the width of view. Here it name is flakeView. Here is the code :
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;
}];
CGRect frame = CGRectMake(xPosition, yPosition, width, height);
flakeView.frame = frame;
Note that xPosition and yPosition are the top left corner, not the center.
精彩评论