Giter VIP home page Giter VIP logo

youngsoft / mylinearlayout Goto Github PK

View Code? Open in Web Editor NEW
4.4K 164.0 899.0 41.31 MB

MyLayout is a powerful iOS UI framework implemented by Objective-C. It integrates the functions with Android Layout,iOS AutoLayout,SizeClass, HTML CSS float and flexbox and bootstrap. So you can use LinearLayout,RelativeLayout,FrameLayout,TableLayout,FlowLayout,FloatLayout,PathLayout,GridLayout,LayoutSizeClass to build your App 自动布局 UIView UITableView UICollectionView RTL

License: MIT License

Objective-C 99.12% Ruby 0.22% HTML 0.23% CSS 0.43%
autolayout android ios uitableview uicollectionview constraints rtl grid-layout layout xib

mylinearlayout's People

Contributors

bicyclering avatar desertyellowemperor avatar irshadpc avatar kinarobin avatar xhl916235259 avatar xjh093 avatar youngsoft avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mylinearlayout's Issues

参数不懂哦

说实话你那些参数都看不懂呢?
topll.weight = 0.5;

在1.3.8版本中.对scrollview与view的关联滚动中出现了问题.

情况:将view和scrollview添加到一个相对布局中,其中view在scrollview的左侧.
需求:scrollview往右边滚动的时候,需要将view跟着往右边移动,设置为view.myLeft = -(scrollView.contentOffset.x);当scrollview往左边滚动的时候,view不动view.myLeft = 0;
问题:当scrollview往右边滚动的时候,操作了view.myLeft = -(scrollView.contentOffset.x)之后,发现scrollview的contentoffset被重置为0了.

README.md有小bug

「版本迁移(老版本迁移需要注意)」标题下的表格错乱。

适配阿拉伯国家

请问这个框架能做到适配阿拉波吗?就是界面从右向左布局,很希望能用上这个库!

线性布局中不能正常使用bringSubviewToFront

您的线性布局顺序应该是根据subviews里面的顺序来排列的 但有的时候 我希望在原来的线性布局顺序下 让界面上方的视图层级变到上层 现在我如果使用bringSubviewToFront,视图frame就会跑到线性布局最下面位置

属性需要加前缀躲避库冲突

你好,我们项目有继承的库,库里面提供了UIview的top,left,right,width,height的快捷属性访问。
这样的话就会和mylayout提供的属性名冲突,建议给整个库的公开属性加前缀,比如ML之类的避免这个问题。

MyFloatLayout weight = 1.f ,视图宽度没有布满

image

MyFloatLayout *layout = [MyFloatLayout floatLayoutWithOrientation:MyOrientation_Vert];
layout.myWidth = self.width;
layout.subviewSpace = 5.f;
layout.myHeight = self.height;
layout.padding = UIEdgeInsetsMake(10.f, 0.f, 0.f, 0.f);
[self.contentView addSubview:layout];
self.layout = layout;

UIImageView *mobileImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"shop_detail_mobile"] highlightedImage:[UIImage imageNamed:@"shop_detail_mobile"]];
[layout addSubview:mobileImageView];
mobileImageView.myWidth = 30.f;
mobileImageView.myHeight = 30.f;
mobileImageView.myTop = 8.f;
mobileImageView.myRight = 10.f;
mobileImageView.reverseFloat = YES;

UILabel *nameLabel = [UILabel new];
nameLabel.textColor = [UIColor blackColor];
nameLabel.font = kSystemFont12;
[layout addSubview:nameLabel];
nameLabel.myHeight = 20.f;
nameLabel.weight = 1.f;
nameLabel.myLeft = 10.f;
self.nameLabel = nameLabel;

UILabel *addressLabel = [UILabel new];
addressLabel.textColor = [UIColor grayColor];
addressLabel.font = kSystemFont10;
[layout addSubview:addressLabel];
addressLabel.myHeight = 20.f;
addressLabel.weight = 1.f;
addressLabel.myLeft = 10.f;
self.addressLabel = addressLabel;


HMSegmentedControl *segmentedControl = [[HMSegmentedControl alloc] initWithSectionTitles:@[@"门店药师",@"门店介绍",@"门店动态"]];
segmentedControl.selectionStyle = HMSegmentedControlSelectionStyleFullWidthStripe;
segmentedControl.selectionIndicatorLocation = HMSegmentedControlSelectionIndicatorLocationDown;
segmentedControl.verticalDividerEnabled = YES;
segmentedControl.verticalDividerColor = kBgColor;
segmentedControl.verticalDividerWidth = CGFloatFromPixel(1.f);
segmentedControl.selectionIndicatorHeight = 1.f;
segmentedControl.selectionIndicatorColor = [UIColor colorWithHexString:@"#B82D2D"];
segmentedControl.selectedTitleTextAttributes = @{NSForegroundColorAttributeName : [UIColor blackColor],NSFontAttributeName:kSystemFont12};
segmentedControl.titleTextAttributes = @{NSForegroundColorAttributeName : [UIColor grayColor],NSFontAttributeName:kSystemFont12};
[layout addSubview:segmentedControl];
self.segmentedControl = segmentedControl;
segmentedControl.clearFloat = YES;
segmentedControl.weight = 1.f;
segmentedControl.myHeight = 40.f;

这个库确实好用不过在用的时候发现了一个bug

bug:在用线性布局的时候MyLinerLayout1和MyLinerLayout2都是使用水平线性布局,加入rootLayout(垂直线性布局)设置了边界属性。但是两个子线性布局会发生重叠现象。在这个两个线性布局中加入了中间量就正常了。可以试着把demo的: LLTest1ViewController 把中间的label去除同时把下面的线性布局改成水平布局就会发现bug在那。

能否支持一下Swift?

直接OC编进Swift的项目中,很多语法都不太明白如何使用了,如view.widthDime.equalTo(),这里的equalTo居然不能传参数

[推广建议] 性能测试报告

已经用在了项目中 并且已经发布到appstore 很好用 感谢;
但是如果作者能给出关于性能方面的测试报告 这样在团队推广的时候更有说服力

MyBaseLayout设置bottomBorderline 线太细导致的闪烁问题

2017-05-20 14_15_00

layout.bottomBorderline.thick = 1.f / scale
@youngsoft 大哥的解答:
因为是这样的。如果你设置0.5的话。我这边会按0.5/2的位置来开始展示。但是因为高清屏的位置必须是0.5的倍数,所以导致转化为像素时就有可能无法正确显示。
比如我的底部的高度是5。你如果设置为了0.5的话那么就是从 4.75 - 5.25 这个区域来绘制边界线。
这样因为4.75这个位置是没法有物理像素的位置对应的。所以就抖了

楼主写的很不错, 只是...

我只说下初次接触这个框架的感觉
不容易理解
不像masonry参考自动布局的方式 就能猜出代码怎么写.
调用比较麻烦
虽然底层实现用frame, 但是调用方式楼主能不能改进一下, 搞简单一些, 比如简单的设置下左间距,右间距,宽度大于等于多少,小于等于多少, 内容不要挤我等等吧
大家熟知的东西,在框架中基本没看到
先从API接口命名开始吧,我个人建议,得在优化优化

UIScrollView 一页页滑动的的约束怎么加 我加了一页垂直线性布局滑不了了

_bottom1 = [[UIScrollView alloc]initWithFrame:CGRectMake(0, CGRectGetMaxY(self.spaceView.frame), mScreenWidth , mScreenHeight - CGRectGetMaxY(self.spaceView.frame))];

    _bottom1.alwaysBounceVertical = YES;
    _bottom1.showsHorizontalScrollIndicator = YES;
    _bottom1.delegate =self;
    _bottom1.tag = 100;
    _bottom1.contentSize = CGSizeMake(self.view.width * 2,_bottom1.height);
    _bottom1.pagingEnabled = YES;

// UIView * view = [[UIView alloc]initWithFrame:CGRectMake(0, 0, mScreenWidth, 300)];
// view.backgroundColor = [UIColor redColor];
// [_bottom1 addSubview:view];

    MyLinearLayout *laScroll = [[MyLinearLayout alloc] initWithOrientation:MyLayoutViewOrientation_Vert];
    laScroll.backgroundColor = [UIColor redColor];

// laScroll.backgroundColor = [UIColor colorWithWhite:0.950 alpha:1.000];
laScroll.myLeftMargin = 0;
laScroll.myHeight = 300;
laScroll.myWidth = 200;
laScroll.wrapContentHeight = YES;
[_bottom1 addSubview:laScroll];

多层嵌套带圆角的view,顶部和底部会被截

我用了一个UILabel放在了一个多层嵌套的layout上,层级结构大致如下:
|- UITableViewCell.contentView
|- layoutRoot (MyRelativeLayout)
|- layoutAccessory (MyLinearLayout,垂直居中)
|- layoutAccessoryBottom (MyLinearLayout,水平靠右)
|- lblBadge

label 的属性设置大致如下:
lblBadge.layer.masksToBounds = YES;
lblBadge.layer.cornerRadius = 8.0f;
lblBadge.heightSize.equalTo(lblBadge.heightSize).add(4.0f).lBound(@16,0,1);
lbl.widthSize.equalTo(lbl.widthSize).add(8.0f).lBound(@16,0,1).uBound(_layoutAccessory.widthSize,0,1);

在这一层时,看起来会被截,如下图(放大后)
attach1

此时 label 的实际宽高都是正确的,同时使用调试视图看,这个view在最顶层,而且没有其他view盖在上面,如下图(放大后)

attach2

如果将这个视图放到 layoutRoot 中,就不会出现这种现象....

我用的是1.3.8版本

框架很强大,但是不习惯。

一下子5-6种布局,在做项目的时候也不知道到底要用那个布局才算好,demo测试里面表格布局-水平表格实现瀑布流能否写个scrollerview复用的列子,因为我可能习惯了tableview和collectionview,如果换成这种demo这种方法,不知道怎么写,求大神指导

子view在切换hidden的时候的动画显示

貌似在动画方面上比较难控制,某个子View要hidden的时候,希望子View有自身的动画效果,同时祖先layout和兄弟layout都要有动画更新。不知道有没有现成的什么好方法?

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.