uiscrollview

UITabBarController with UIScrollView. Scroll offset change when tab switch

雨燕双飞 提交于 2020-01-13 06:27:11
问题 I have successfully created a TabBar with two ScrollView-tabs. However, if i scroll to the bottom in one tab and then switch tab and then switch back, my content seem to have disappeared upwards. If i try to scroll to the top i get stuck in the middle of the content but the scrollview thinks im at the top. What i know so far: contentView.frame.origin.y - (contentView is my view that resides in the ScrollView). If i print this variable when scrolling the first time i get 0 in every printout. I

UITabBarController with UIScrollView. Scroll offset change when tab switch

家住魔仙堡 提交于 2020-01-13 06:26:46
问题 I have successfully created a TabBar with two ScrollView-tabs. However, if i scroll to the bottom in one tab and then switch tab and then switch back, my content seem to have disappeared upwards. If i try to scroll to the top i get stuck in the middle of the content but the scrollview thinks im at the top. What i know so far: contentView.frame.origin.y - (contentView is my view that resides in the ScrollView). If i print this variable when scrolling the first time i get 0 in every printout. I

Horizontal UISwipeGestureRecognizer in subview of UIScrollView ? (UIScrollView only needs to recognize vertical scrolling)

岁酱吖の 提交于 2020-01-13 05:45:08
问题 I have a UIScrollView where I added a subview. The scrollview scrolls fine vertically and that is all it should do. I would now like to recognize left/right swipes in the subview with the help of a UISwipeGestureRecognizer. I know it is possible, but I have not come across a solution and several tries have been unsuccessful. 回答1: Try these: Set the delegate of your UIGestureRecognizer and Implement shouldRecognizeSimultaneouslyWithGestureRecognizer : -(BOOL)gestureRecognizer:

Get all indexPaths in a section

江枫思渺然 提交于 2020-01-13 03:54:13
问题 I need to reload the section excluding the header after I do some sort on my tableview data. That's to say I just want to reload all the rows in the section. But I don't find a easy way to make it after I search for a while. reloadSections(sectionIndex, with: .none) not works here, for it will reload the whole section including the header, footer and all the rows. So I need to use reloadRows(at: [IndexPath], with: UITableViewRowAnimation) instead. But how to get the whole indexPaths for the

UITableView jumpy on scroll after changing cell height

折月煮酒 提交于 2020-01-13 03:51:07
问题 So I have a tableView where I want to change the height of a cell when tapped. Well, actually, I am replacing it with a bigger cell. On tap, I call: tableView.beginUpdates() tableView.reloadRowsAtIndexPaths([indexPath], withRowAnimation: .Fade) tableView.endUpdate() And then I modify my cellForRowAtIndexPath to return the right new cell and height. The cell's height is being automatically calculated by overriding sizeThatFits in the cell's implementation: override func sizeThatFits(size:

Play sound when UIScrollView is scrolling

喜夏-厌秋 提交于 2020-01-12 10:52:50
问题 I have a scroll view that can be scrolled to the sides (only left and right, not up and down). I want to play a short sound (less than a second) whenever the scroll view is moved X pixels to either side. How can this be done? Code samples will be greatly appreciated... Thanks, 回答1: Here is the code I used: I added the SoundEffect.h and SoundEffect.m files to my project (you can find them online). Then, I created a sound effect instance: SoundEffect *soundEffect; Then, I setup my

UIKit: UIScrollView automatically scrolling when a subview increases its width past the edge of the screen

大城市里の小女人 提交于 2020-01-12 06:58:08
问题 In the context of the iPhone: I have a UIScrollView containing a UIImage . When the user taps the screen inside the UIImage , a UITextField is added where the user touched. The user can edit this UITextField , and the text field will automatically resize itself based on whether text was added or deleted. When the a UITextField being edited increases its width, the scrollview automatically scrolls to show the increased width. The problem comes in because the automatic scrolling of the

Detect UIScrollview bottom reached

a 夏天 提交于 2020-01-12 06:48:09
问题 I have a UIScrollView with images and when the user scrolls to the end of the scrollview i want to update the content. This is my code to detect when the bottom of the scrollview is reached: The code below is implemented in scrollViewDidScroll: delegate CGFloat scrollViewHeight = imagesScrollView.bounds.size.height; CGFloat scrollContentSizeHeight = imagesScrollView.contentSize.height; CGFloat bottomInset = imagesScrollView.contentInset.bottom; CGFloat scrollViewBottomOffset =

dequeueReusableCell breaks cliptobounds

眉间皱痕 提交于 2020-01-11 08:01:31
问题 I've got a very simple UIScrollView with some content (many subviews). This scroll view is used to show some posts made by users (image + text). One of these views is actually the image of the author and it overflows bottom cell bounds. It is thus overlapped with the cell coming after, and using clipToBounds = false I'm able to obtain the desired result. Everything works great if I scroll down. When I start to scroll back up the view that previously was overlying now gets clipped. Cell

Fixed / Float view in UIScrollView with AutoLayout

妖精的绣舞 提交于 2020-01-11 05:13:06
问题 In this technical Note Apple states that you can make a subview of UIScrollView fixed / floating by adding constraints to UISCrollView's superview. I tried that but I'm doing something wrong and I can't figure out whats the problem. Note that you can make a subview of the scroll view appear to float (not scroll) over the other scrolling content by creating constraints between the view and a view outside the scroll view’s subtree, such as the scroll view’s superview. That's what I did. I have