0

In one of my view controller (using Storyboard and ARC mode), i add two scrollView methods?

- (void)scrollViewDidScroll:(UIScrollView *)scrollView 
{
}

- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView
{
}

Both of them are not work on my app.

I already add scroll view as sub view of self.view
But, why these scroll view methods are not work? Please, give me some ideas.

Night Hunter
  • 123
  • 1
  • 2
  • 13

1 Answers1

1

These are UIScrollViewDelegate methods.You have to properly setup the VC as the scrollview delegate and connect the delegate from xib to the VC

  1. Add <UIScrollViewDelegate> to your VC

.h File

@interface ExampleVC <UIScrollViewDelegate>

makes the exampleVC a reciever for the UIScrollViewDelegate methods.

  1. From Xib connect the scrollview delegates to the files owner (Right click on the scrollview in storyboard and there drag the delegate to the view controller object and thats it)

EDIT If you are creating a scrollview programatically

[scrollView setDelegate:self];

can do the job

Lithu T.V
  • 19,955
  • 12
  • 56
  • 101
  • Thanks for your quick reply. I'm sorry for my incomplete question. I don't use delegate. I just use view controllers in storyboard and connect them with segue. So, how can i do? Please. – Night Hunter Feb 17 '13 at 20:08
  • the remaining to do is what i said – Lithu T.V Feb 17 '13 at 20:09
  • you have to include these steps to the code and then you can see the methods hitting – Lithu T.V Feb 17 '13 at 20:14
  • http://stackoverflow.com/questions/2534094/what-is-a-delegate-in-objective-cs-iphone-development – Lithu T.V Feb 17 '13 at 20:18
  • i add interface ExampleVC is ok in .h file. But, i create scrollView from program(in .m file). Not from IB. How can i do in .m file? I'm new in iOS. Please, give me a patient. :) – Night Hunter Feb 17 '13 at 20:31
  • @NightHunter : From Xib connect the scrollview delegates to the files owner (Right click on the scrollview in storyboard and there drag the delegate to the view controller object and thats it) – Vinodh Feb 18 '13 at 09:40
  • @ Lithu T.V, sorry for my late reply, i really thanks you for your help. Now, i can scroll my app. Thanks you so much. – Night Hunter Feb 20 '13 at 00:01