I am trying to graph large amounts of data in a UIView as a subview of a UIScrollView. In order to overcome the memory limitations surrounding enormous UIViews, I plan, once the scrollview's offset has reached the maximum or minimum offset, to redraw the view with the new data either with a lesser "x" value if it has reached minimum, or visa versa, and then increase the view's offset to the opposite of its current position (ie MAX-->MIN and MIN-->MAX). I have attempted this with the following code.
- (void)scrollViewDidScroll:(UIScrollView *) scrollViewer {
CGPoint p = scrollViewer.contentOffset;
if(p.x==0){
if(appDel.windownum>0){
appDel.windownum--;
[graphview setNeedsDisplay];
}
}
if(p.x==1000){
if(appDel.pcont>appDel.windownum*100){
appDel.windownum++;
[graphview setNeedsDisplay];
}
}
}
appDel.windownum
is the reference for the graph section the view is currently displaying. If it equals zero, it is displaying the first hundred values. If it is one, the next hundred, etc. Once this variable has been reset in the appDelegate, the graph is redrawn with the new index of values, and the scrolloffset is reset. However, when this code is run, the program crashes. With and error:
TERMINATING_DUE_TO_UNCAUGHT_EXCEPTION
It crashes in the simulator. What have I done wrong?
XCode 3.2.1 iPhone Firmware 3.1.3