xcode如何定义视图的高度和宽度

arv*_*abi 1 iphone height width uiimageview

大家好我是法国人因为我的英语而烦恼我这里是我的问题:我们如何定义视图的高度和宽度.这里它的名字是flakeView.这是代码:

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;
                 }];
Run Code Online (Sandbox Code Playgroud)

Mar*_*ell 7

CGRect frame = CGRectMake(xPosition, yPosition, width, height);
flakeView.frame = frame;
Run Code Online (Sandbox Code Playgroud)

请注意,xPosition和yPosition是左上角,而不是中心.