Skip to content

Commit 54c3bc8

Browse files
committed
Update README.md
1 parent beb30ec commit 54c3bc8

3 files changed

Lines changed: 68 additions & 2 deletions

File tree

README.md

Lines changed: 67 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,69 @@
1+
[![CocoaPods](https://img.shields.io/cocoapods/v/VirtualView.svg)]() [![CocoaPods](https://img.shields.io/cocoapods/p/VirtualView.svg)]() [![CocoaPods](https://img.shields.io/cocoapods/l/VirtualView.svg)]()
2+
13
# VirtualView
24

3-
A solution to create custom view dynamically.
5+
A solution to create & release UI component dynamically.
6+
7+
It a part of our [Tangram](https://github.com/alibaba/Tangram-iOS) solution. And it can be used as a standalone library.
8+
9+
中文站点:[VirtualView](http://tangram.pingguohe.net/docs/virtualview/about-virtualview)
10+
11+
## Features
12+
13+
![xml](https://github.com/alibaba/VirtualView-iOS/raw/master/README/feature.png)
14+
15+
1. Write component via XML.
16+
2. Compile XML to a out (binary) file.
17+
3. Load out file in iOS application.
18+
4. Create component from loaded template and bind data to it.
19+
5. Show the component.
20+
21+
## Install
22+
23+
### CocoaPods
24+
25+
Use VirtualView alone:
26+
27+
pod 'VirtualView', '~> 1.0'
28+
29+
Use VirtualView with [Tangram](https://github.com/alibaba/Tangram-iOS):
30+
31+
pod 'Tangram', '~> 2.0'
32+
33+
CocoaPods will install VirtualView as a part of Tangram 2.0.
34+
### Source codes
35+
36+
Or you can download source codes from [release page](https://github.com/alibaba/VirtualView-iOS/releases) and put them into your project.
37+
38+
## How to use
39+
40+
1. Load component template from out file.
41+
42+
```objective-c
43+
NSString *path = [[NSBundle mainBundle] pathForResource:@"icon" ofType:@"out"];
44+
NSData *buffer = [NSData dataWithContentsOfFile:path];
45+
[[VVBinaryLoader shareInstance] loadFromBuffer:buffer];
46+
```
47+
48+
2. Create component.
49+
50+
```objective-c
51+
self.container = (VVViewContainer *)[[VVViewFactory shareFactoryInstance] obtainVirtualWithKey:@"icon"];
52+
[self.view addSubview:self.container];
53+
```
54+
55+
3. Bind data and calc the layout.
56+
57+
```objective-c
58+
self.container.frame = CGRectMake(0, 0, SCREEN_WIDTH, 1000);
59+
[self.container update:@{
60+
@"type" : @"icon",
61+
@"imgUrl" : @"https://test.com/test.png"
62+
}];
63+
```
64+
65+
See more details in the demo project.
66+
67+
## Tools
68+
69+
See more details [here](https://github.com/alibaba/virtualview_tools).

README/feature.png

99.4 KB
Loading

VirtualView.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Pod::Spec.new do |s|
22

33
s.name = "VirtualView"
44
s.version = "1.0.0"
5-
s.summary = "A solution to create custom view dynamically."
5+
s.summary = "A solution to create & release UI component dynamically."
66
s.homepage = "https://github.com/alibaba/VirtualView-iOS"
77
s.license = { :type => 'MIT' }
88
s.author = { "HarrisonXi" => "gpra8764@gmail.com" }

0 commit comments

Comments
 (0)