-
Notifications
You must be signed in to change notification settings - Fork 257
FAQ
The frame of view will be CRectZero after xml loaded (like UIViewController::viewDidLoad). The frame will be available after FlexRootView::layoutSubViews. You can get notification of layout by observing FLEXDIDLAYOUT in NSNotificationCenter.
Do not use FlexRootView::onDidLayout block, it's designed for internal usage.
You should update your pod repository:
pod update FlexLib
[!] The platform of the target FlexLib_Example
(iOS 9.3) is not compatible with Yoga (1.8.0)
, which does not support ios
.
It's because Yoga(1.8.0) not support iOS. You can lock Yoga version in Podfile:
pod 'Yoga', '1.6.0'
Please check your simulator setting: goto "Hardware -> Keyboard", checked "Use the Same Keyboard as macOS" and "Connect Hardware keyboard" If still not work, please restart your simulator and Xcode.
Please check your simulator network, make sure your mac http server is accessible on safari.
Possible reasons & solutions:
- proxy or vpn has been set, you need to close it.
- In iOS system settings -> Developer -> Allow HTTP Services
- App http access was not allowed by default. You must turn on it.
- Maybe iOS simulator need restart.
- Turn off wifi, then turn on it.
In layout file, only view attribute support multi-language. For the attribute value, you can use @ to reference the string in Localizable.strings. Like
<UILabel attr="text:@title"/>
Notice: if the first character is @, you should use @@ instead of @. Like
<UILabel attr="text:@@title"/>
The label text will be @title, not the string in Localizable.strings.
By default, the framework will fetch the localizable string from mainBundle. You can implement bundleForStrings in owner to change it.
Yes, I recommend it. Although FlexBaseVC works well in most case, you may need some custom behaviour like different safe area for iPhoneX, custom keyboard toolbar etc.
Of course you can. But your custom view class must conform with the following rules:
- All the initialization must be done in init method. Any other init function like initWith... will not be called.
- You can extend view attributes with FLEXSET macro, then you can set the attribute in xml file. Then you can use your custom view.
Yes. You should override the createView:Name: method in the owner like ViewCtronller, TabelCell,...
- Call FlexSetScale(factor,offset) to set factor and offset
- In layout file, change number value with * prefix. like:
<UILabel attr="fontSize: *16"/>
The final font size will be 16*factor+offset
- If your string should start with *, you should use ** instead of *. Thanks for 青柠.
- Both view attribute and layout attribute support to scale the number.
No. Support network image will need network framework. It will make this framework overstaffed. You can use FLEXSET macro to extend the attribute of UIImageView if you really need it.
First, FlexLib expect the view of view controller is full screen. Then FlexBaseVC adjust the frame of FlexRootView by getSafeArea to the right region. If the view of view controller is not full screen, you will need to override the getSafeArea to adjust the frame of FlexRootView. Please see the wiki to get more information.
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