logo
down
shadow

iOS- ScrollView not working with Auto Layout


iOS- ScrollView not working with Auto Layout

By : Matteo Lelli
Date : November 19 2020, 01:01 AM
I hope this helps you . I am trying to add scroll view with AutoLayout. But ScrollView not working. Here I attached screen shot.
code :
    scrollView.contentSize = CGSizeMake(self.view.window.frame.size.width, 530);


Share : facebook icon twitter icon
Embed ImageView in ScrollView with Auto Layout on iOS 6

Embed ImageView in ScrollView with Auto Layout on iOS 6


By : Nermano Franco Ferre
Date : March 29 2020, 07:55 AM
wish of those help I just encountered the same issue in a tutorial that I was updating. I attempted programmatically deleting constraints, cursing, and banging my head against the wall - no luck.
About 5 minutes ago, however, I tried something that had fixed another issue I encountered, and, ta da! UIScrollView is working again! The solution was to move the old code that sets the UIScrollView contentSize property into an implementation of viewDidAppear, rather than viewDidLoad:
code :
- (void)viewDidAppear:(BOOL)animated {
    [super viewDidAppear:animated];
    self.theScroller.contentSize=CGSizeMake(200.0,2000.0);
}
How to add a uiTextfield to a scrollview programmatically using auto layout

How to add a uiTextfield to a scrollview programmatically using auto layout


By : Rathan Raja Rajendre
Date : March 29 2020, 07:55 AM
wish of those help I have used the same code that you posted and modified few constraints and added some.
code :
 UITextField *emailField = [[UITextField alloc] init];
    emailField.backgroundColor = [UIColor lightGrayColor];
    emailField.translatesAutoresizingMaskIntoConstraints = NO;
    self.emailField = emailField;

    UIScrollView *scrollView = [[UIScrollView alloc] init];

    self.scrollView = scrollView;
    [self.scrollView setTranslatesAutoresizingMaskIntoConstraints:NO];
    [self.view addSubview:self.scrollView];

    NSDictionary *views = @{ @"view":self.view, @"scrollView":self.scrollView,  @"textField":self.emailField, @"topLayoutGuide": self.topLayoutGuide};

    [self.view addConstraints: [NSLayoutConstraint constraintsWithVisualFormat:@"V:|[scrollView]|"
                                                                       options:0
                                                                       metrics:nil
                                                                         views:views]];

    [self.view addConstraints: [NSLayoutConstraint constraintsWithVisualFormat:@"H:|[scrollView]|"
                                                                       options:0
                                                                       metrics:nil
                                                                         views:views]];

    [self.emailField setTranslatesAutoresizingMaskIntoConstraints:NO];
    [self.scrollView addSubview:self.emailField];


    [self.view addConstraint:[NSLayoutConstraint constraintWithItem:self.emailField
                                                          attribute:NSLayoutAttributeLeading
                                                          relatedBy:NSLayoutRelationEqual
                                                             toItem:self.scrollView
                                                          attribute:NSLayoutAttributeLeading
                                                         multiplier:1.0
                                                           constant:10]];
    [self.view addConstraint:[NSLayoutConstraint constraintWithItem:self.emailField
                                                          attribute:NSLayoutAttributeTrailing
                                                          relatedBy:NSLayoutRelationEqual
                                                             toItem:self.scrollView
                                                          attribute:NSLayoutAttributeTrailing
                                                         multiplier:1.0
                                                           constant:10]];

    [self.view addConstraint:[NSLayoutConstraint constraintWithItem:self.emailField attribute:NSLayoutAttributeWidth
                                                          relatedBy:NSLayoutRelationEqual
                                                             toItem:self.scrollView
                                                          attribute:NSLayoutAttributeWidth
                                                         multiplier:1.0
                                                           constant:-20]];

    [self.view addConstraints: [NSLayoutConstraint constraintsWithVisualFormat:@"V:[topLayoutGuide][textField(46)]"
                                                                             options:0
                                                                             metrics:nil
                                                                               views:views]];
scrollView: how to create a pure auto layout scrollview with paging?

scrollView: how to create a pure auto layout scrollview with paging?


By : Svyatozar
Date : March 29 2020, 07:55 AM
I wish this help you Ok, there's a few things wrong here:
else if (i == self.pageImages.count)
code :
        [self.scrollView addConstraints:
         [NSLayoutConstraint constraintsWithVisualFormat:@"H:-(10)-[topLabel]-(10)-|"
                                                 options:0 metrics:nil
                                                   views:viewsDictionary]];
        [self.scrollView addConstraints:
         [NSLayoutConstraint constraintsWithVisualFormat:@"H:-(10)-[imageView]-(10)-|"
                                                 options:0 metrics:nil
                                                   views:viewsDictionary]];

        [self.scrollView addConstraints:
         [NSLayoutConstraint constraintsWithVisualFormat:@"H:-(10)-[bottomLabel]-(10)-[button]-(10)-|"
                                                 options:0 metrics:nil
                                                   views:viewsDictionary]];
   @"H:[prevBottomLabel]-(10)-[bottomLabel]....

   prevBottomLabel = bottomLabel;
   // Continue loop
   UIImageView* imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:[self.pageImages objectAtIndex:i]]];

    imageView.frame = CGRectMake(0,0,200,200);

    imageView.translatesAutoresizingMaskIntoConstraints = NO;
    imageView.contentMode = UIViewContentModeScaleAspectFit;
   [imageView addConstraints:
         [NSLayoutConstraint constraintsWithVisualFormat:@"H:[imageView(200)]"
                                                 options:0 metrics:nil
                                                   views:viewsDictionary]];

   [imageView addConstraints:
         [NSLayoutConstraint constraintsWithVisualFormat:@"V:[imageView(200)]"
                                                 options:0 metrics:nil
                                                   views:viewsDictionary]];
How to use a scrollview containing buttons with auto layout

How to use a scrollview containing buttons with auto layout


By : Hryggjarsula
Date : March 29 2020, 07:55 AM
it helps some times You can set the contentSize of the UIScrollView to be larger than the visible screen. The buttons can be sized and placed in a way to have all 5 buttons visible (with the 5th button actually off screen). The scrollView will bring the 5th button into view when scrolling.
I worked up a simple prototype using just a storyboard (and setting the contentSize of the scrollview in Runtime Attributes section, but this could be done in code if you need to pragmatically determine the button sizes.
Scrollview with navigation bar + auto layout

Scrollview with navigation bar + auto layout


By : ehlnofex
Date : March 29 2020, 07:55 AM
wish help you to fix your issue I have a ViewController embedded in NavigationController. I placed ScrollView inside it, then content view covering the full area (to set ScrollView's content size) and some labels. I tried to set constraints for all of the controls but I failed. , Swift 3:
Related Posts Related Posts :
  • Unclear about releasing CFDictionaryRef
  • CordovaError: Promise rejected with non-error: Error code 65
  • How to append NSMutable strings into a UILabel
  • CustomCell label value does not change
  • Display ad in iAd Bannerview iAd Network
  • Warning: "Could not get traitsetID for iPhone11,6" (Assets.xcassets)
  • Changing root view controller after iOS app has loaded.
  • SocketRocket and iOS certificate pinning
  • Draggable UIButton Snap To a Circle Path
  • Running FireBase in the background
  • resizing UIPopoverController to fit UITableController
  • UICollectionView Exception Crash
  • targeting iOS5 - will it work on iOS6 also?
  • FBLoginView get email
  • Scale UIImages height to UIImageView height
  • Creating a custom progress indicator in ios
  • NSRunLoop API difference
  • Is it possible to inject custom settings into my iOS application "Notifications" settings dialog?
  • UIAlertview not accepting string as message
  • Axis change of stackView giving layout error
  • How to use AVAssetResourceLoader?
  • How to write block definition using properties?
  • iOS connect/reconnect to Bluetooth device when using external-accessory and MFi
  • Saving XMPP Multi User chat messages through XMPP MessageArchiving in iOS
  • Deciding iOS version: pros and cons
  • iOS: Resigned app cannot access keychain through security API
  • How can I set To and Subject fields in an E-Mail being sent by UIDocumentInteractionController?
  • Updating uilabel in view controller underneath another
  • Maximum time Intervel for NSTimer
  • Delete Core Data Entry from Table View Controller
  • How to unload UIViewcontroller from memory?
  • Compressing UIImage as Far as Possible?
  • Optimizing workflow to update internally owned cocoapods dependencies?
  • Formatting an NSDate with Abbreviated Month/Day Names
  • I'm creating a quiz game with 4 answers and I want to add score
  • Tap Gesture to Hide Navigation Bar, Tab Bar, and Status Bar
  • FBSessionStateClosedLoginFailed when I am logged in through Settings
  • CGRect positioning according to center point
  • iOS: Update table view datasource with animations without core data
  • iOS : Where to start for AliPay integration?
  • Routing App Coverage File missing but not needed?
  • Drawing on a zoomable view
  • Append NSStrings and NSNumber to NSMutableArrays and make NSMutable dictionary
  • Terminating app due to uncaught exception 'NSRangeException' when calling dequeueReusableCellWithReuseIdentifier:forInde
  • Collision without physics (Cocos2D + Box2D iOS)
  • Creating a percentage based iOS layout
  • Update tableView row from AppDelegate Swift 4
  • Assigning return value of a class method to a variable error
  • how to display circular progress in delphi ios apps?
  • I can't figure how to fix this Expected identifier or '('
  • How to Test APIs in Swift 4?
  • Link error /Build/Products/Debug-iphonesimulator file not found
  • working with a very large JSON object in iOS
  • Turn off part of the iPhone Screen
  • Phonegap 3.0 app with facebook login using xCode
  • How to add interstitial admob ads to my ios project
  • adding tapku calendar to ios app
  • Add an alertcontroller in a global swift file?
  • Take square image with Cordova (Phonegap) Camera API?
  • Amazon S3 policy allowing only upload not overwrite
  • shadow
    Privacy Policy - Terms - Contact Us © ourworld-yourmove.org