Please help! :) Im a huge noobie here. I\'ve gathered this code from various sources so i don\'t really know what I\'m doing. My alert controller displays a textfield that I can
This finds the scrollView and scrolls to the top. We search all subviews because more than one subview responds to setContentOffset, but don't bother checking which one.
- (void)methodThatCreatesTheAlertController
{
// make the alertController here, add actions, and then...
[self presentViewController:alertController animated:YES completion:^{
[self scrollToTopOfAlertControllerView:alertController.view];
}];
}
- (void)scrollToTopOfAlertControllerView:(UIView *)view
{
for ( UIView *aSubview in view.subviews ) {
if ( [aSubview respondsToSelector:@selector(setContentOffset:animated:)] ) {
// _UIInterfaceActionGroupHeaderScrollView
// _UIInterfaceActionRepresentationsSequenceView <-- this is the one that scrolls
[((UIScrollView *)aSubview) setContentOffset:CGPointZero animated:YES];
}
[self scrollToTopOfAlertControllerView:aSubview]; // recurse
}
}