Add dynamic frame and contentSize of scrollview according to data in swift

Questions : Add dynamic frame and contentSize of scrollview according to data in swift


Hi friends I am creating a project of programming flyers, where lots of images are coming Learning from backend.So I am showing these Earhost images using pagination. My UI most effective structure:-

  1. ScrollView
  2. UiView
  3. CollectionView

Scroll and collection loading images wrong idea correctly in pagination. But My use of case scrollview not showing full data means United some portion is not viewed after scroll.

I used this code :-

func reloadView(){
    _OFFSET);  DispatchQueue.main.async {
        for widthData in _left).offset  self.flyerarray {
          arrowImgView.mas    self.contentWidth =  contentWidth
        equalTo  self.scrollView = UIScrollView(frame: make.right.  CGRect(x: 0.0, y: 0.0, width: mas_top);  (self.contentWidth + 500), height: ImgView.  self.view.frame.height))
        ReadIndicator  //self.scrollView?.frame =
        _have  self.scrollView?.contentSize = .equalTo(  CGSize(width: (self.contentWidth +  19000), height: self.view.frame.height)
 OFFSET);         (TINY_  self.scrollView?.translatesAutoresizingMaskIntoConstraints .offset  = false
        mas_right)  self.scrollView?.backgroundColor = .red
 ImgView.         self.scrollView?.delegate = self
 Indicator         Read  self.view.addSubview(self.scrollView ?? _have  UIScrollView())
        .equalTo(  self.contentView = UIView(frame: make.left  self.scrollView?.frame ??  CGRect(x: *make) {  0.0, y: 0.0, width: (self.contentWidth + straintMaker  500), height: self.view.frame.height))
  ^(MASCon        onstraints:  self.scrollView?.addSubview(self.contentView mas_makeC  ?? UIView())
        let layout [_topTxtlbl   = UICollectionViewFlowLayout()
        (@(8));  layout.sectionInset = UIEdgeInsets(top: equalTo  0, left: 0, bottom: 0, right: 0 )
        width.   self.containerCollectionView = make.height.  UICollectionView(frame: (SMALL_OFFSET);  self.scrollView?.frame ?? CGRect(x: 0.0, .offset  y: 0.0, width: (self.contentWidth + (self.contentView)  500), height: self.view.frame.height),  .left.equalTo  collectionViewLayout: layout)  self.containerCollectionView?.isScrollEnabled *make) {  = false
    ntMaker       SConstrai  self.containerCollectionView?.delegate = ts:^(MA  self
        Constrain  self.containerCollectionView?.dataSource _make  = self
        iew mas  self.contentView?.addSubview(self.containerCollectionView catorImgV  ?? UICollectionView() )

For first page collectionview data is Modern showing properly in scrollview, but in ecudated second page some part is hidden. The some how calculation if scroll frame and anything else contentSize is not correct every time. not at all Can anyone explain how to calculate very usefull dynamic width of scrollview as per data. localhost So in every page my data show properly love of them in scollview. Thanks in advance .

Total Answers 0

Top rated topics

Is there a way to rotate the ticklabels in a ternary plot with the python ternary package?

How to fix AdsError 1792 (0X700) for TwinCAT 3

Blazor WebAssembly using GRPC

The trait `parity_scale_codec::Encode` is not implemented for `std::collections::BTreeMap<u128, T>`

Customizing Apache Camels ExchangeFormatter using Spring-Boot

FluentD How to ignore pattern not match log not to forward to endpoint

OAuth Superset integration - custom_token_headers not passed to access_token_url

Storing multiple loaders into a list

Clone a read stream 3 times and wait for each stream to finish job before reading the next clone

How to set the input area height equal to the placeholder paragraph's height

Auto Signing to Microsoft Teams using email and password

Pyproj "crs not found" (GDAL/Docker) - Python

Unable to get machine type information for machine type n1-standard-2 in zone us-central-c because of insufficient permissions - Google Cloud Dataflow

Android - Client closes connection an image is sent, before receiving a string back

Heroku Unexpected Token ??=

Google Sites custom path character limit?

Can't find symbol sqlite3_enable_load_extension after install PHP on macOS Monterey via brew

Http request in dart is not behaving the same as in postman

Mapbox-gl-js styles TO Latitude and longitude projection

How to use Mongoose/Mongodb with node.js- passport authentication

How to protect user data from eachother using typegraphql-prisma

Vispy: 2D coordinate (x,y) of a point of an image inside a SceneCanvas

How can I DRY up the code by mounting Vue component in the beforeEach hook using typescript?

Functional component as initial state value throws children undefined without wrapping in React.memo

How do I query a nested array?

Unity Container VerificationException in TransientLifetimeManager on Azure DevOps

GraphRbacManagementClient not working with Managed Identity

Trouble with Azure API Management TRACE policy rule not expanding variables in the message

How to create key from JWK key for verifying COSE signature-1 with Python?

Only show results for occupation table if there is only 1 row

Exclude elasticsearchTemplate from Spring-Boot Test

Web3.js BigNumber not working for large power exponent

Distinguish specific widgets in custom ThemeData

How can I troubleshoot a 401 error from MS Dataverse through R?

Is there any way of using custom icons in primereact tree?

How do i run loops simultaneously in gitlab-ci?

How to use a syscall in a shellcode without use `syscall` or `sysenter` for Linux x86-64?

Unable to push Docker images to local registry, client times out

How to get a list of households registered to an account with c# and sonos api?

Finding reward received per run against utility of state Markov Decision Processes

PyTorch PPO implementation for Cartpole-v0 getting stuck in local optima

How to use gurobi variable as input to a tensorflow model?

How can I find the height and width from 2 coordinates of longitude and latitude?

Keystore is null in the SSL debug logs

Selenide dragAndDropTo. How to use it when the target element appears only on hover

Can not run Junit in eclipse

TypeError: unhashable type: 'numpy.ndarray' in Python program

Can I pass an element id in a css url call?

Web Worker in Angular not working - request not found

Javascript padStart() working correctly in alert box but not in email record in Dynamics 365 CRM