3 Star 0 Fork 0

Gitee 极速下载 / jtscrollviewcontroller

Create your Gitee Account
Explore and code with more than 12 million developers,Free private repositories !:)
Sign up
此仓库是为了提升国内下载速度的镜像仓库,每日同步一次。 原始仓库: https://github.com/jonathantribouharet/JTScrollViewController
Clone or Download
contribute
Sync branch
Cancel
Notice: Creating folder will generate an empty file .keep, because not support in Git
Loading...
README
MIT

JTScrollViewController

CI Status Version License Platform

JTScrollViewController help you to create pragmatically a UIViewController with a UIScrollView which take all the space available using Auto Layout without using a nib file. It creates all constraints required for your views.

Installation

With CocoaPods, add this line to your Podfile.

pod 'JTScrollViewController', '~> 1.0'

Usage

Create a controller which inherit from JTScrollViewController.

#import <UIKit/UIKit.h>
#import <JTScrollViewController.h>

@interface MyViewController : JTScrollViewController

@end

Create your views in the viewDidLoad and call configureConstraintsForSubviews for create all constraints. You can call addVerticalSpacingForStatusBar when you don't want the scrollView go under the status bar.

Each views are displayed in the orders they were added to contentView. You have to set the height of each views by setting the height of their frames. You can also add a space between each views by settings y property of their frames.

#import "MyViewController.h"

@implementation MyViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
    
    // Add all your views to self.contentView
    // Do your stuff...
    {
        CGFloat spaceFromTop = 30.;
        UITextField *textField = [UITextField alloc] initWithFrame:CGRectMake(0, spaceFromTop, 0, 45)];
        [self.contentView addSubview:textField];
    }
    
    {
        UITextField *textField = [UITextField alloc] initWithFrame:CGRectMake(0, 5, 0, 45)];
        [self.contentView addSubview:textField];
    }

    {
    	UIButton *button = [[UIButton alloc] initWithFrame:CGRectMake(0, 10, 0, 50)];
        [self.contentView addSubview:button];
    }

    // Add vertical space (22px) for the status bar
    // Use this when you don't have a navigation bar and you don't want the scroll go under the status bar
    [self addVerticalSpacingForStatusBar:YES];

    // Call configureConstraintsForSubviews for create all constraints
    [self configureConstraintsForSubviews];
}

Requirements

  • iOS 7 or higher
  • Automatic Reference Counting (ARC)

Author

License

JTScrollViewController is released under the MIT license. See the LICENSE file for more info.

Copyright (c) 2014 Jonathan Tribouharet Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

JTScrollViewController 在 iOS 上创建一个 ScrollViewController,使用 Auto Layout,不需要使用一个 nib 文件 expand collapse
Cancel

Releases

No release

Contributors

All

Activities

Load More
can not load any more
Ruby
1
https://gitee.com/mirrors/jtscrollviewcontroller.git
git@gitee.com:mirrors/jtscrollviewcontroller.git
mirrors
jtscrollviewcontroller
jtscrollviewcontroller
master

Search