I am a novice to learn xcode just a few days, dragging an Image View control (pic) and Button controls (show) in xib above, hoping to achieve is to click the button to display a picture (menu.png) on the screen, but by the After no response. Brother, I ask you where wrong ah? Image control or set wrong? Or picture the wrong position (I put the project folder, a second floor are placed)
Here is the code for the button event:
- (IBAction) show: (id) sender {
pic.image = [UIImage imageNamed: @ "menu_bg.png"];
[Pic setNeedsDisplay];
}
Reply:
Implements draw your own way?
If not, you are in the process of block in the [pic setNeedsDisplay] removed, rewrite [self.view addSubView: pic]; can.
Reply:
Plus break with what processes.
Reply:
Are you sure you're connected to the xib in the methods it?
file's owner
Reply:
1 Make sure XIB file in the file control link on IBOUT
FILE owner in the statement
2 links on methods to ensure a BUTTON in the touch up inside event
Is generally not a problem
Reply:
Are generally small problem ...
Agree upstairs issues
Reply:
Break down in the end to see the code does not run, you did not run could be related to the process BUTTON Button
Reply:
Resource directory xcode project the picture onto the left navigation bar under it? You add the file directory is useless
Reply:
Thank you for your answer above, has been resolved, which is not joined to the resources and can not be dynamically added to UIImageview controls inside, direct statement, and then add the code to use
No comments:
Post a Comment