简体   繁体   English

UIImageView * XXX = [[UIImageView分配] initWithImage:XXX]

[英]UIImageView* XXX = [[UIImageView alloc] initWithImage:XXX]

WHat does this line of code : WHat执行以下代码行:

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

if it help Then I have this : 如果有帮助的话,我有这个:

int startX2 = round(random() % 480);
// set the flake start position
flakeView.frame = CGRectMake(startX2, 330.0, 30,  20);
flakeView.alpha = 1;

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

The line: 该行:

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

creates a container "UIImageView" object that contains an image "UIImage" stored in an ivar flakeImage 创建一个容器"UIImageView"对象,该对象包含存储在ivar flakeImage中的图像"UIImage"

The rest of the code positions flakeView on the main view with assigned x,y,width and hight properties. 其余代码将flakeView定位在主视图上,并分配了x,y,width和hight属性。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM