uiscrollviewdelegate

UIScrollView doesn't remember the position

廉价感情. 提交于 2019-12-05 22:15:39
Has anyone ever had the problem that a UIScrollView , which gets moved by [UIScrollView setContentOffset:...] doesn't "remember" it's new position? It however does, if the user scrolls via touch-and-drag. Symptoms: If the UIScrollView doesn't remember the new position, it "flips" back to the original position it last remembers (which is the position which has been used via touch-and-drag) whenever it's being touched. Interesting: This only happens in 4.0 and didn't happen in 3.1 This only happens if pagingEnabled == YES is set It turned out that the contentInsets would confuse the

UIScrollView not respecting minimumZoomScale after changing the subview

自古美人都是妖i 提交于 2019-12-05 13:36:46
I'm hitting a problem getting a UIScrollView to update correctly in response to a change in the minimum zoom scale. The scrollview has a UIImageView as a subview, and the image property of the UIImageView is set in response to the didFinishPickingMediaWithInfo method of UIPickerView: - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info { UIImage *takenImage = [info objectForKey:UIImagePickerControllerOriginalImage]; [self.imageView setImage:takenImage]; [self.imageView setFrame:CGRectMake(self.imageView.frame.origin.x, self

iOS. How do I restrict UIScrollview scrolling to a limited extent? [duplicate]

…衆ロ難τιáo~ 提交于 2019-12-05 05:49:47
This question already has answers here : Limiting the scrollable area in UIScrollView (4 answers) Closed 6 years ago . What is the best way to set limits on the left/right scrolling of a UIScrollView. I would have thought this would be easy but all my attempts have been unsuccessful. So, to be clear, I need a solution that will allow me to programmatically limit the scrolling extent whenever I need to during the use of my app. This will most often be in response to changes in the data being displayed. Thanks, Doug You can control the size of contents using contentSize property of scroll view.

How to use UIScrollView to switch between UIViews

泪湿孤枕 提交于 2019-12-05 05:49:23
问题 How would I build multiple UIViews with multiple subviews and switch between them using a UIScrollView ? I would appreciate anyone who can upload some code. I am a complete noob withe the iPhone. 回答1: I would "tile" the UIViews in the UIScrollView, then implement some kind of paging or "snap-to" mechanism. Listen on the appropriate notifications from the scroll view, then whenever scrolling finishes, just programmatically align the scroll view to the boundaries of one of your tiled UIViews.

How much contentOffset changes in UIScrollview for zooming?

守給你的承諾、 提交于 2019-12-04 13:03:02
In UIScrollview, when I scroll/drag, I got changes in scrollview contentOffset which represent how much I had scrolled/dragged in the scrollview. By this way, I have updated the subview of scrollview for scrolling. But, when I zoom the scrollview (using pinch zooming), the contentOffsets of the scrollview is also changed. I do not understand how much contentOffset has changed because I can not relate the changes with zoomScale value. So, is there anyway to know changes in contentOffset for zooming? My intention is get the value of contentOffset changes for dragging while zooming (which is not

How can I get a UIWebView's UIScrollView delegate methods called from within a standard UIViewController?

独自空忆成欢 提交于 2019-12-04 10:44:51
So I just have a standard UIViewController with a UIWebView in it that displays a pdf. For the app functionality, I have need to be able to respond to the UIWebView's nested UIScrollView events like scrollViewWillBeginDragging, scrollViewDidScroll, etc. The only way I can get access to the scrollView is to (it seems like a hack) go in and get it by the subviews array: for (id subview in webView.subviews){ if ([[subview class] isSubclassOfClass: [UIScrollView class]]) { UIScrollView * s = (UIScrollView*)subview; s.delegate = self; s.tag = 1; scrollView = s; } } But that seems to introduce more

How can I test if the scroll view is bouncing?

你说的曾经没有我的故事 提交于 2019-12-04 09:12:48
问题 How can I test if the scroll view is bouncing? Is there a notification or something when the bounce ends? 回答1: Yes... check out the UIScrollViewDelegate spec, implement the methods including the two below, and set your UIScrollView's delegate accordingly: // User stops dragging the table view. - (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate; // Control slows to a halt after the user drags it - (void)scrollViewDidEndDecelerating:(UIScrollView *

How to use UIScrollView to switch between UIViews

旧城冷巷雨未停 提交于 2019-12-03 21:39:42
How would I build multiple UIViews with multiple subviews and switch between them using a UIScrollView ? I would appreciate anyone who can upload some code. I am a complete noob withe the iPhone. I would "tile" the UIViews in the UIScrollView, then implement some kind of paging or "snap-to" mechanism. Listen on the appropriate notifications from the scroll view, then whenever scrolling finishes, just programmatically align the scroll view to the boundaries of one of your tiled UIViews. Alternately, look at using UIPageControl to implement this kind of behavior. The Weather app is a good

Objective C switch statements and named integer constants

醉酒当歌 提交于 2019-12-03 12:12:09
I have a controller which serves as a delegate to two scrollviews which are placed in view managed by aforementioned view controller. To distinguish between two scroll views I'm trying to use switch statement (instead of simple pointer comparison with if statement). I have tagged both scroll views as 0 and 1 like this NSUInteger const kFirstScrollView = 0; NSUInteger const kSecondScrollView = 1; When I try to use these constants in a switch statement, the compiler says that case statements are not constants. switch (scrollView.tag) { case kFirstScrollView: { // do stuff } case

iphone: scroll in a view

∥☆過路亽.° 提交于 2019-12-03 09:14:38
I would like to ask a basic iphone question. I have many TextFields in iPhone view, when I tap to input in a TextField, the Keyboard shows up and hide other TextField. I would like to make the parent view scrollable. Would you please show me the example code? Thank you very much You can listen for the keyboard up and down notification. and move your view just above height of keyboard. In the ViewWillAppear method: NSNotificationCenter *nc = [NSNotificationCenter defaultCenter]; [nc addObserver:self selector:@selector(keyboardWillShow:) name: UIKeyboardWillShowNotification object:nil]; [nc