【问题标题】:insertSubView:belowSubview: for a UIImageViewinsertSubView:belowSubview: 用于 UIImageView
【发布时间】:2012-06-06 21:58:34
【问题描述】:

如果可以使用 insertSubView:belowSubview: 我很伤心:因为下面的代码正在抛出这个警告错误

Incompatible pointer types sending 'UIImage *__strong' to parameter of type 'UIView *'

我希望也许我做错了什么你们可以看到,因为我能想到的唯一其他方法是将 UIImageView 放入 UIView...请告诉我有更好的方法..哈哈

代码如下。

UIImage *shadowImage = [UIImage imageNamed: @"shade.png"];
UIImageView *shadowImageView = [[UIImageView alloc] initWithImage:shadowImage];

[otherNav.view addSubview:shadowImageView];
[otherNav.view insertSubview:shadowImage belowSubview:animatedActionView];

任何帮助将不胜感激。

【问题讨论】:

    标签: iphone ios uiview uiimageview addsubview


    【解决方案1】:

    试试这个

    [otherNav.view insertSubview:shadowImageView belowSubview:animatedActionView];
    

    因为第一个参数必须是View或者uiview的子类

    在您的情况下,您尝试传递不是 UIView 或 UIview 子类的 UIImage

    【讨论】:

    • opps.. 我的错误。我还拿出了愚蠢的 [otherNav.view addSubview:shadowImageView];... 把自己搞混了,我一辈子都看不到它。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-07-29
    • 2016-06-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多