Have implemented a UIScrollView album where in the +2 and -2 positioned SubViews are generated when scrollViewDidEndDragging
is called but adding the Subviews is a costly operation and hence the slide through is not so very smooth. The screen sticks a bit at the end of dragging.
I have even tried delayed calling using NSTimer
or performSelector
but in case the user glides through all images with speed then all the delayed calls are called at once and at times crashes the application.
-(void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate
{
flyNumber = (NSInteger)(imageScrollView.contentOffset.x/imageScrollView.frame.size.width);
[self createM2P2SubView];
//[self performSelector:@selector(createM2P2SubView) withObject:nil afterDelay:0.1];
//[NSTimer scheduledTimerWithTimeInterval:0.1 target:self selector:@selector(createM2P2SubView) userInfo:nil repeats:NO];
NSLog(@"End dragging ...... %d",flyNumber);
}
Please provide a solution in removing that glitch.