将图像添加到其他视图中的按钮 [英] adding image to a button in other View

查看:112
本文介绍了将图像添加到其他视图中的按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用程序中我有两个视图控制器并且在两个视图中都有表视图。两个视图表中都有某些按钮显示某些图像。现在我正在尝试使用UIPopOverController.for将新图像设置为视图B中的按钮到视图A.我创建了一个B类对象然后这样做。

In my app i have two view controllers and have table view in both.Both table view have certain button showing certain images .Now i am trying to set a new image to a button in view B through view A using UIPopOverController.for this i created an object of class B and then done like this.

[ObjB.button setImage:[UIImage imageNamed:@1.pngforstate:UIControlStateNormal];

[ObjB.button setImage:[UIImage imageNamed:@"1.png" forstate:UIControlStateNormal];

但我无法在按钮上获得新图像。可能是什么原因。请帮助。任何帮助将不胜感激。

but i am not able to get the new image on the button.What could be the possible reason.Please help.Any help will be appreciated.

谢谢,
Christy

Thanks, Christy

推荐答案

当你从popovercontroller转到View时B保留B控制器对象。

when you are going from popovercontroller to View B retain the B controllers object.

这篇关于将图像添加到其他视图中的按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆