-
Notifications
You must be signed in to change notification settings - Fork 257
Hot preview
- call FlexRestorePreviewSetting when app start.
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
FlexRestorePreviewSetting();
// any other initiation ...
return YES;
}
This function will do nothing for product version.
- start HTTP Server on your mac.
Enter your project directory in terminal, then
python -m SimpleHTTPServer 8000 #for python 2.x
python -m http.server 8000 #for python 3.x
- set preview base url
Open preview setting page, you can use one of the following ways:
- press Command+D when any sub class of FlexBaseVC appear. This is simplest way but only available in DEBUG mode.
- call FlexSetPreviewVC::presentInVC in your app to open this page.
Then you can set the preview base url.
There are three ways to do it:
-
press Control+E when sub class of FlexBaseVC appear. This will open 'Online Flex Explorer', then you can navigate and view your xml layout by HTTP Protocol. You can also call FlexHttpVC::presentInVC to make it available.
-
press Command+R when your view controller appears. This will reload your view controller layout but not call your any initiation methods like viewDidLoad.
-
In preview setting page, turn on 'Online load resource'. Then all the layout will be loaded by HTTP Protocol. You can reopen the current page to refresh it. This will works well even your page need some network request.
Notice: Cmd+R should be pressed on simulator when view controller is shown, not in XCode. The base url will be used to concate the resource url. For example, if the base url is 'http://ip:port/abc/' and you want to access flex resource 'TestVC', then your final url will be 'http://ip:port/abc/TestVC.xml'
Flexbox Introduction & performance (in Chinese)
Tutorial 1: Create View Controller with xml layout
Tutorial 2: Create Table Cell with xml layout
Tutorial 3: Embed xml layout into traditional view hierarchy
Tutorial 4: Use custom view in xml layout
Tutorial 5: Create reusable view using xml layout file