I am attempting to use a UIPageControl
for the first time and I can't seem to get it to call a function on UIControlEventValueChanged
. Am I missing something here? I even tried a storyboard implementation but same broken results. I tried UIControlEventTouchUpInside
and other actions as well. None are calling the changePage:
function below.
In the .h:
@property (nonatomic, retain) UIPageControl *introPageControl;
-(IBAction)changePage:(id)sender;
In the .m:
@synthesize introPageControl;
- (void)viewDidLoad {
[super viewDidLoad];
self.introPageControl = [[UIPageControl alloc] initWithFrame:CGRectMake(0,208,self.view.frame.size.width,36)];
self.introPageControl.numberOfPages = 4;
self.introPageControl.currentPage = 0;
[self.introPageControl addTarget:self action:@selector(changePage:) forControlEvents:UIControlEventValueChanged];
[self.view addSubview:self.introPageControl];
}
-(IBAction)changePage:(id)sender {
// NEVER GETS CALLED :(
}
The UIControlEventValueChanged is only called when the UIPageControl view object was tapped.