I am working on book reader app in which i want to Turn pages using UISlider
I have tried following code in viewdidload:
pageSlider =[[UISlider alloc]initWithFrame:CGRectMake(15, 350, 250, 15)];
[self.pageSlider addTarget:self action:@selector(turnPageWithSlider:) forControlEvents:UIControlEventValueChanged];
self.pageSlider.minimumValue = 0;
self.pageSlider.maximumValue = [self numberOfPagesInLeavesView:self->leavesView];
self.pageSlider.value = self->leavesView.currentPageIndex;
[self.view addSubview:pageSlider];
and the method:
(void)turnPageWithSlider:(id)sender
{
objScaner.keyword = nil;
[leavesView reloadData];
int pageIndex = (int) [self.pageSlider value];
[self.pageSlider setValue:(float)pageIndex];
self->leavesView.currentPageIndex = pageIndex;
[self displayPageNumber:pageIndex + 1];
}
but here turnPageWithSlider:
method is not called
slider is appearing but not working properly
thanks.....
try to replace pageslider with self.pageslider
in the first line where you are initialising and also when you adding subview.