-1

I'm working with nibs and I added a scroll view to the view controller and now I want to get the view controller to be the delegate for the scroll view so i can use the methods I gel, like scrollViewDidScroll.

I already added the UIScrollViewDelegate class to the view controller implementation signature.

I also control dragged an outlet from the nib file to the view controller.h file.

What else do I need here to make the view controller to respond to scrollViewDidScroll?

tnx ahead!

JohnBigs
  • 2,691
  • 3
  • 31
  • 61

1 Answers1

2

Do you have an outlet for your scrollview like:

@property (nonatomic, weak) IBOutlet UIScrollView scrollView; 

If so then in viewDidLoad put:

self.scrollView.delegate=self;

Another way would be to click on the scrollView in the xib and in property inspector have it show the connections (icon with right facing arrow and circle around it at top of inspector view), then drag from the delegate shown there to the view controller in the structure.

Fraggle
  • 8,607
  • 7
  • 54
  • 86