开发者

Setting Background image of button as a Image view Image

开发者 https://www.devze.com 2023-02-20 19:37 出处:网络
I\'v an application in which i want to set the image of my image view same as my button, which is been clicked..

I'v an application in which i want to set the image of my image view same as my button, which is been clicked.. i'm using this code;

mainSlideShowImageView.image=((UIButton *)sende开发者_StackOverflowr).image;

but there is Error..

65: error: request for member 'image' in something not a structure or union

what is other way to do So?


[(UIButton *)sender imageForState:UIControlStateNormal];

or, if it's a background image, backgroundImageForState:.


Try using currentImage or currentBackgroundImage like so:

UIButton *ad = [[UIButton alloc] initWithFrame:CGRectZero];
UIImageView *iV = [[UIImageView alloc] initWithImage:ad.currentBackgroundImage];

or

UIButton *ad = [[UIButton alloc] initWithFrame:CGRectZero];
UIImageView *iV = [[UIImageView alloc] initWithImage:ad.currentImage];


Try this

UIButton *button = (UIButton *)sender;
mainSlideShowImageView.image= button.currentImage;
0

精彩评论

暂无评论...
验证码 换一张
取 消