uiscrollview

iOS UIScrollView with autolayout not centering correctly

*爱你&永不变心* 提交于 2019-12-25 04:17:15
问题 After googling and searching for a solution to this I have decided just to ask a question. I am trying to setup a UIScrollView with AutoLayout being left on. I have been researching this all day and finally got the ScrollView to behave correctly with AutoLayout by putting a child view inside of it and then all of the subviews inside of that. I set up the constraints in the Scroll View to 0 on all 4 sides, same with the ContentView (subview of ScrollView) and then set the ContentView and the

iOS do not forward touches to views below

左心房为你撑大大i 提交于 2019-12-25 04:09:35
问题 In my app I have UIScrollView which has many UITableViews. In cells of this table there is UISlider. How I can disable touch forwarding if user make scroll gesture on table view? Now if user make scroll gesture near slider (but not on it) the touch event gets forwarder to scroll view. 回答1: You can subclass UIScrollView and add this method to the new class - (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event { UIView *result = [super hitTest:point withEvent:event] ; self.scrollEnabled

Check if cell completely displayed in collectionview

不羁的心 提交于 2019-12-25 04:09:05
问题 I have a collection view where the cell is of the size exactly to the collectionView, so each cell should occupy the whole screen. I have implemented a functionality where the cell is snapped to the complete view whenever it's dragged or decelerated through the scroll. This is how the UX works. https://drive.google.com/open?id=1v8-WxCQUzfu8V_k9zM1UCWsf_-Zz4dpr What I want: As you can see from the clip, the cell snaps to the whole screen. Now, I want to execute a method after it snaps. Not

Cannot get UIButton autoresizingMask to work

房东的猫 提交于 2019-12-25 04:03:22
问题 I have the following code: - (void)loadView { [super loadView]; UIScrollView *scroll = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 87, self.view.frame.size.width, self.view.frame.size.height)]; scroll.pagingEnabled = YES; NSInteger numberOfViews = 2; scroll.contentSize = CGSizeMake(self.view.frame.size.width * numberOfViews, self.view.frame.size.height); scroll.autoresizingMask=(UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight); [self.view addSubview:scroll]; for (int

Cannot get UIButton autoresizingMask to work

梦想的初衷 提交于 2019-12-25 04:03:12
问题 I have the following code: - (void)loadView { [super loadView]; UIScrollView *scroll = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 87, self.view.frame.size.width, self.view.frame.size.height)]; scroll.pagingEnabled = YES; NSInteger numberOfViews = 2; scroll.contentSize = CGSizeMake(self.view.frame.size.width * numberOfViews, self.view.frame.size.height); scroll.autoresizingMask=(UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight); [self.view addSubview:scroll]; for (int

UITextFied in UIScrollView not enabled after scrolling

强颜欢笑 提交于 2019-12-25 03:50:14
问题 I Added a UIScrollView in a ViewController, And Added UIView under that UIScrollView I added total number 10 UITextFields in that UIView , Scrolling is Working fine While running App in Simulator/ iPhone, the First 6 UITextFields Working [Responding to touches] which are shown on the screen without scrolling, Remaining 4 UITextFields are not working [Not responding to the touches], which will shown after scrolling Please can any one guide me to resolve this issue? thank you UPDATE: I Used it

Adding a UIButton to UIScrollView

我是研究僧i 提交于 2019-12-25 03:29:11
问题 I am trying to add the UIButton to UIScrollView . I have added the UIImageView with background image *(size: 320 * 620)*. Then I added this UIImageView to UIScrollView , and It works fine. But now I want to add UIButton at position at : (60, 500); (below screen that would appear after scrolling). I have tried following code, but the button is added on UIView not on scrollview. Button is not getting displayed on the top. Code : - (void)viewDidLoad { [super viewDidLoad]; self

UICollectionView isn't scrolling to indexPath

随声附和 提交于 2019-12-25 03:12:18
问题 I have a UICollectionView that I set the translatesAutoresizingMaskIntoConstraints to NO , and added some constraints . When I try scrolling it to an indexPath : [self.datesCollectionView selectItemAtIndexPath:selectedCellIndexPath animated:YES scrollPosition:UICollectionViewScrollPositionCenteredHorizontally]; Then it completely ignores that, and doesn't scroll. But when I remove translatesAutoresizingMaskIntoConstraints , then it scrolls, but the constraints are ignored. My question is, How

iPhone: CATiledLayer/UIScrollView wont scroll after zooming and only zooms to anchor point

ε祈祈猫儿з 提交于 2019-12-25 03:03:00
问题 Here is the problem... I am using CA Tiled Layer to display a large jpg. The view loads okay, and when I go to scroll around, it works fine. However, as soon as I zoom in or out once, it scrolls to the top left (to the anchor point) and will not scroll at all. The zooming works fine, but I just cannot scroll. Here is my code: #import <QuartzCore/QuartzCore.h> #import "PracticeViewController.h" @implementation practiceViewController //@synthesize image; - (void)viewDidLoad { NSString *path = [

Multiple image in scrollview

会有一股神秘感。 提交于 2019-12-25 02:44:41
问题 I have 12 images and i want to display this images in UIScrollview with 4 rows where each rows have 3 images. 回答1: x=0; y=0; UIScrollView *scroller=[[UIScrollView alloc]init]; scroller.frame=CGRectMake(20.0, 10.0, 250.0, 250.0); // WithFrame:CGRectMake(6, 0, 250, 250)]; scroller.delegate=self; [self.view addSubview:scroller]; [scroller setContentSize:(CGSizeMake(300,(([mainArray count]+3-1)/3)*20))]; //main array means ur image array for (int i=1; i<[mainArray count]+1; i++) { if (x%3==0) { x