簡単な質問があります。皆さんが答えてくれることを願っていました。現在、ストーリーボードに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
どんな助けでも大歓迎です。ありがとう