有个小问题,希望大家能帮我解答。现在我在情节提要中有一个 UIPageControl 可以根据您所在的点更改图像,但是,到目前为止,您必须按下点才能更改点/图像,我该如何更改图像/点通过刷卡?
这是我的 .h 代码
#import <UIKit/UIKit.h>
@interface PageViewController : UIViewController
@property (strong, nonatomic) IBOutlet UIImageView *dssview;
- (IBAction)changephoto:(UIPageControl *)sender;
@end
这是我的 .m 代码
#import "PageViewController.h"
@interface PageViewController ()
@end
@implementation PageViewController
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (IBAction)changephoto:(UIPageControl *)sender {
_dssview.image = [UIImage imageNamed:
[NSString stringWithFormat:@"%d.jpg",sender.currentPage+1]];
}
@end
任何帮助将不胜感激。谢谢