嗨,我是iPhone的Xcode开发的新手,我坚持实现历史功能。Xcode基本历史功能
通俗地说我有
4个按钮(每个具有它自己独特的图像)
(按钮1) (按钮2) (按钮3) (按钮4)
(imageview position 2) (imageview position 3) (imageview position 2) (imageview position 4) (imageview position 5)
每次点击一个按钮(最多5次),我需要它显示在适当的图像视图。
即,如果按钮4被按下第一它将在图像视图中显示1 如果按钮3被按下第二它将在图像视图2等
显示我非常感谢一些援助或推在正确的方向。
在此先感谢
更新代码:
viewcontroller.h
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController {
IBOutlet UIImageView *imageview_history_1;
IBOutlet UIImageView *imageview_history_2;
IBOutlet UIImageView *imageview_history_3;
IBOutlet UIImageView *imageview_history_4;
IBOutlet UIImageView *imageview_history_5;
}
// I would think this could be consolidated into one function
-(IBAction)showhistory_1;
-(IBAction)showhistory_2;
-(IBAction)showhistory_3;
-(IBAction)showhistory_4;
-(IBAction)showhistory_5;
@end
#import ViewController.h"
@interface ViewController()
@end
@implementation ViewController
// function to add to history
// Need an if/for statement???
// On button event 1 display result at image view_history 1,
// On button event 2 display result at image view_history 2.
- (IBAction)showhistory_1 {
UIImage *img = [UIImage imageNamed:@"button1"];
[imageview_history_1 setImage:img];
}
@end
//我被困在创建功能。再次感谢。
一般来说,为这些问题提供一些代码是一个好主意,所以我们知道你在哪里以及我们需要带你去哪里。 –
嗨@RyanPoolos希望更新的代码有助于理解我想要实现的目标。再次感谢。 – Anthony
并且不要使用这样的帖子标题,因为这个标题对于这个问题是不正确的。 – vishiphone