【问题标题】:UIImageView* XXX = [[UIImageView alloc] initWithImage:XXX]UIImageView* XXX = [[UIImageView alloc] initWithImage:XXX]
【发布时间】:2011-05-08 07:36:26
【问题描述】:

这行代码是做什么的:

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

如果有帮助那么我有这个:

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];

【问题讨论】:

    标签: iphone cocoa-touch animation random uiimageview


    【解决方案1】:

    行:

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

    创建一个容器 "UIImageView" 对象,其中包含存储在 ivar flakeImage 中的图像 "UIImage"

    其余的代码位置 flakeView 位于主视图上,并分配了 x、y、width 和 hight 属性。

    【讨论】:

    • 是的,但是当我希望 flakeImage 与另一个发生碰撞时,我不知道会发生什么,但没有接触另一个它会发生碰撞,我认为这是由于容器造成的。我该如何解决这个问题?
    • 你想知道这行代码做了什么,我告诉你我不知道你在说什么碰撞?您这里的代码只是一个视图的初始化!
    猜你喜欢
    • 2013-06-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多