IOS develops Zfui framework controls to make layout easier

Source: Internet
Author: User

From: http://www.jianshu.com/p/bcf86b170d9c

Objective

Why would you write this? Because in the iOS development, the layout of the interface has no Android layout has so many methods and advantages, my personal development is pure code, masonry This framework I also do not use in development, one is the code layout, the amount of code is more, in addition, as if there is a problem in the iOS10 layout, There are some ways to solve the problem on the Internet.

So just want to be able to customize some UI controls to make the layout easier

Implementation ideas

Like Android Wrap_content, Uilabel can show the width and height of the control based on the content.

Currently available in the Zfui framework only Uilabel and UIButton methods are available

They all inherit the corresponding parent class, and then rewrite the method in the parent class to make the control easier and easier to use

Implementation method

Directly on the code, demo and framework can go to GitHub to download

Https://github.com/joshuaGeng/ZFUI-Framework

First, add the Zfui.framework to the project.

method to invoke

#import <ZFUI/ZFUI.h>

To create a label method

Zfuilabel *label = [[Zfuilabel alloc] init];

Label.numberoflines = 0;

Label.backgroundcolor = [Uicolor Greencolor];

[Label setlabeltext:@ "HelloWorld" Andwithframe:cgrectmake (100, 70, 0, 0)];

Label.iscancopy = YES;

Label.titlecopy = @ "Copy";

Set different colors

[Label SetAttributeColorWithAllStr:label.text Andallcolor:[uicolor Redcolor] andwithdiffstr:@ "World" anddiffcolor:[ Uicolor Blackcolor]];

[Self.view Addsubview:label];

button

Zfuibutton *button = [[Zfuibutton alloc] Initwithframe:cgrectmake (100, 120, 120, 60)];

[Button setimage:[uiimage imagenamed:@ "img"] forstate:uicontrolstatenormal];

[Button settitle:@ "button" forstate:uicontrolstatenormal];

Button.backgroundcolor = [Uicolor Orangecolor];

Button.btnimgrect = CGRectMake (10, 20, 22, 21);

Button.btntitlerect = CGRectMake (50, 20, 120, 30);

[Self.view Addsubview:button];

Currently provides the ZFUI framework only provides the Uilabel and UIButton methods, the follow-up will continue to update, there is a need to download, the comments in the demo is very detailed.

IOS develops Zfui framework controls to make layout easier

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.