2012-06-06 31 views
1

我woundering如果可以使用insertSubView:belowSubview:目前的情況是下面的代碼引發此警告錯誤insertSubView:belowSubview:對於一個UIImageView

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

任何幫助將不勝感激。

回答

2

試試這個

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

,因爲第一個參數必須試圖傳遞一個UIImage的誰itsn't的UIView

的UIView的或亞型的視圖或在您的案件的UIView

的子類

+0

opps ..我的錯誤。我也拿出了愚蠢的[otherNav.view addSubview:shadowImageView]; ...讓我自己高興地混在那裏,只是無法看到它爲我的生活。 – HurkNburkS

+0

一旦時間到了,我會盡快接受你的回答。 – HurkNburkS