Code Monkey home page Code Monkey logo

lzfixview's Introduction

LZFixView

At least, every view can be composed of five subviews (top, left, bottom, right, middle). Normally when middleView is the instance of UIScrollView or subClass of UIScrollView, we hope that top (or left, bottom, right) view can scroll as middleView scrolls, but if the content size of middleView is smaller than its frame, we hope side views can be set as fixed or not.


This class is created to fulfill above reqirement.

@interface LZFixView : UIView
@property (strong, nonatomic) UIView *topView;
@property (strong, nonatomic) UIView *leftView;
@property (strong, nonatomic) UIView *bottomView;
@property (strong, nonatomic) UIView *rightView;

//Normally middleView is instance of UIScrollView or sub class of it.
@property (strong, nonatomic) UIScrollView *middleView;

// default value is NO; When relevant view is not nil, we need bellow bool values to decide whether relevant view can be scrolled with middleview(当页面内容超出页面范围时,这四个属性可以设置四边view是跟在跟随内容滚动,还是固定在四边)
@property (assign, nonatomic) BOOL fixTop;
@property (assign, nonatomic) BOOL fixLeft;
@property (assign, nonatomic) BOOL fixBottom;
@property (assign, nonatomic) BOOL fixRight;

// default value is NO; When contentHeight of midView is much smaller than its frameHeight, we need bellow two properties to decide bottom view and right view to show just under content or on the bottom and th right(当页面内容很短或是很窄时,这两个属性可以设置底部和右边view是跟在内容后面,还是固定在最底部;当然考虑到内容是从上往下,从左往右显示,所以顶部和左边就不考虑这种情况了)
@property (assign, nonatomic) BOOL fixBottomInside;
@property (assign, nonatomic) BOOL fixRightInside;

// default value is NO; Only works when middleView.bounces = YES;(当middleView的bounces被设为YES后,可以改变以下属性来分别决定四边view是否跟随middleView一起拉伸反弹)
@property (assign, nonatomic) BOOL topBounces;
@property (assign, nonatomic) BOOL leftBounces;
@property (assign, nonatomic) BOOL bottomBounces;
@property (assign, nonatomic) BOOL rightBounces;

//Called every time contentOffset or contentSize changed (eg. you drag middleView, called in delegate method scrollViewDidScroll:)
@param scrollView - middleView
- (void)adjustSideViewsLocationForView:(UIScrollView *)scrollView; @end

lzfixview's People

Contributors

zhizi-z avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.