0

I am facing a weird issue, scenario is I am working some other's code and there is viewController for profile and there are textfields in viewController.. Let me explain briefly the hierarchy of viewController

View -UIScrollView -TextFields (A lot of) -UIButtons

Issue is when I drag finger on UITextfield the scrollView do not scroll and if I drag other then Textfields view or empty view and even on UItextView the scroll works.

More I have created a new project in Xcode 7.3 and copy scrollView from the actual project I am working to new Project and enabled the property DelaysContent in ScrollView and it's working perfectly even if I dragged on textfield view..

Can someone help me regarding this what should I do.?

Ravi Dhorajiya
  • 1,531
  • 3
  • 21
  • 26
Muhammad Awais
  • 340
  • 3
  • 15

1 Answers1

1

I think If you create textField programmatically, you would not have added to ScrollView.So add to scrollView.

[viewTextField addSubview:textField];
[scrollView addSubview:viewTextField];

Then content size for scroll view is important

CGSize contentSize = scrollView.frame.size;
contentSize.height = 500; //Please set your required height
[scrollView setContentSize:contentSize];

Before that you have to set the delaysContentTouches and canCancelContentTouches to YES or NO depends on the below suggestion.

UIScrollView with Buttons

Adding Button to ScrollView

Community
  • 1
  • 1
user3182143
  • 9,459
  • 3
  • 32
  • 39