Saturday, September 28, 2013

XCODE4.2 achieve a simple picture display function

iPhone apps in Xcode4.2 write, there is automatic memory recovery

Implementation: There is a button, when clicked pictures replaced 2.jpg

Button event has already bound interface buttons. There is also a ImageView
interface
I have to write any code button event. .

I now write so
 
UIImage * image = [UIImage imageNamed: @ "2.jpg"];
imageView = [imageView initWithImage: image];


Point button has no effect. . .
Reply:
ImageView. Image = [UIImage imageNamed: @ "2.jpg"];
[ImageView setNeedsDisplay];
Reply:
ImageView.backgroundColor = [UIColor colorWithPatternImage: [UIImage imageNamed: @ "2.jpg"]];

No comments:

Post a Comment