Question

I am using a CGFloat value to set my scrollView's contentSize so that it adjusts dynamically to content populated in my textviews. I determine the heights of each text view and their positions in the viewDidLoad method, but have to set the scrollView height in the viewWillAppear method - otherwise the contentSize isn't correct and the scrollView won't scroll. The problem is, the CGFloat value isn't accessible in the viewWillAppear method.

How can I pass that value between the two methods?

Was it helpful?

Solution

You need to make private ivar in .m file to use it as cache between methods in you class.

@implementation YOUR_CLASS_NAME 
{ 
    CGFloat _height; 
} 
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top