Skip to content

Getting Started

zhenglibao edited this page Dec 29, 2017 · 7 revisions

FlexLib is a framework for creating native iOS applications using a human-readable markup language, similar to Android and .NET development way.

Get FlexLib

FlexLib is developed as freely open-source project on Github. You can get it through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'FlexLib'

Then import FlexLib.h in your project.pch:

#import <FlexLib/FlexLib.h>

Create your first view controller with FlexLib

Derive HelloWordVC from FlexBaseVC

@interface HelloWordVC : FlexBaseVC

@end

@implementation HelloWordVC

- (void)viewDidLoad {
    [super viewDidLoad];
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
}
@end

Notice: you need to write nothing. Just derive it from FlexBaseVC will work.

Write your layout file with name 'HelloWordVC.xml'

The name 'HelloWordVC' is not necessary, but it will simplify to init the view controller.

This file looks:

<?xml version="1.0" encoding="utf-8"?>
<UIView layout="flex:1,justifyContent:center,alignItems:center" attr="bgColor:white">
    <UILabel attr="fontSize:16,color:#333333,text:helloWord"/>
</UIView>

Use this view controller as normal

HelloWordVC* vc = [[HelloWord alloc]init];
[navigationController pushViewController:vc animated:YES];

Build & run it.

Clone this wiki locally