문제

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?

도움이 되었습니까?

해결책

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; 
} 
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top