feat:fix iOS UIImageView wrapcontent

This commit is contained in:
pengfei.zhou 2019-11-20 13:52:30 +08:00
parent ff0d2d9a13
commit c8feaa37fc
5 changed files with 15 additions and 2 deletions

View File

@ -6,6 +6,8 @@ const imageUrls = [
'http://f.hiphotos.baidu.com/image/pic/item/0e2442a7d933c8956c0e8eeadb1373f08202002a.jpg', 'http://f.hiphotos.baidu.com/image/pic/item/0e2442a7d933c8956c0e8eeadb1373f08202002a.jpg',
'http://f.hiphotos.baidu.com/image/pic/item/b151f8198618367aa7f3cc7424738bd4b31ce525.jpg', 'http://f.hiphotos.baidu.com/image/pic/item/b151f8198618367aa7f3cc7424738bd4b31ce525.jpg',
'http://b.hiphotos.baidu.com/image/pic/item/0eb30f2442a7d9337119f7dba74bd11372f001e0.jpg', 'http://b.hiphotos.baidu.com/image/pic/item/0eb30f2442a7d9337119f7dba74bd11372f001e0.jpg',
'http://a.hiphotos.baidu.com/image/h%3D300/sign=b38f3fc35b0fd9f9bf175369152cd42b/9a504fc2d5628535bdaac29e9aef76c6a6ef63c2.jpg',
'http://h.hiphotos.baidu.com/image/pic/item/810a19d8bc3eb1354c94a704ac1ea8d3fd1f4439.jpg',
'http://calonye.com/wp-content/uploads/2015/08/0-wx_fmtgiftpwebpwxfrom5wx_lazy1-9.gif', 'http://calonye.com/wp-content/uploads/2015/08/0-wx_fmtgiftpwebpwxfrom5wx_lazy1-9.gif',
'http://hbimg.b0.upaiyun.com/ca29ea125b7f2d580f573e48eb594b1ef509757f34a08-m0hK45_fw658', 'http://hbimg.b0.upaiyun.com/ca29ea125b7f2d580f573e48eb594b1ef509757f34a08-m0hK45_fw658',
'https://misc.aotu.io/ONE-SUNDAY/SteamEngine.png', 'https://misc.aotu.io/ONE-SUNDAY/SteamEngine.png',
@ -31,7 +33,7 @@ class SliderPanel extends Panel {
renderPage: (idx) => { renderPage: (idx) => {
return slideItem(image({ return slideItem(image({
imageUrl: imageUrls[idx % imageUrls.length], imageUrl: imageUrls[idx % imageUrls.length],
layoutConfig: layoutConfig().wrap().a(gravity().center()), layoutConfig: layoutConfig().w(LayoutSpec.WRAP_CONTENT).h(LayoutSpec.WRAP_CONTENT).a(gravity().center()),
})).also(it => { })).also(it => {
let start = idx let start = idx
it.onClick = () => { it.onClick = () => {

View File

@ -153,8 +153,8 @@
E2334AF222E9D2060098A085 /* ViewController.m */, E2334AF222E9D2060098A085 /* ViewController.m */,
E2334AF422E9D2060098A085 /* Main.storyboard */, E2334AF422E9D2060098A085 /* Main.storyboard */,
E2334AF722E9D2070098A085 /* Assets.xcassets */, E2334AF722E9D2070098A085 /* Assets.xcassets */,
E2334AF922E9D2070098A085 /* LaunchScreen.storyboard */,
E2334AFC22E9D2070098A085 /* Info.plist */, E2334AFC22E9D2070098A085 /* Info.plist */,
E2334AF922E9D2070098A085 /* LaunchScreen.storyboard */,
E2334AFD22E9D2070098A085 /* main.m */, E2334AFD22E9D2070098A085 /* main.m */,
D751D19E97EF4EDD7588FEBE /* DemoVC.m */, D751D19E97EF4EDD7588FEBE /* DemoVC.m */,
D751DDEC114E037231257E64 /* DemoVC.h */, D751DDEC114E037231257E64 /* DemoVC.h */,

View File

@ -34,6 +34,13 @@
<string>UIInterfaceOrientationLandscapeLeft</string> <string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string> <string>UIInterfaceOrientationLandscapeRight</string>
</array> </array>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
<key>LSApplicationCategoryType</key>
<string></string>
<key>UISupportedInterfaceOrientations~ipad</key> <key>UISupportedInterfaceOrientations~ipad</key>
<array> <array>
<string>UIInterfaceOrientationPortrait</string> <string>UIInterfaceOrientationPortrait</string>

View File

@ -39,6 +39,7 @@ - (instancetype)initWithContext:(DoricContext *)doricContext {
- (void)initWithSuperNode:(DoricSuperNode *)superNode { - (void)initWithSuperNode:(DoricSuperNode *)superNode {
[super initWithSuperNode:superNode]; [super initWithSuperNode:superNode];
self.reusable = YES; self.reusable = YES;
self.view.clipsToBounds = YES;
} }
- (DoricStackView *)build { - (DoricStackView *)build {

View File

@ -152,4 +152,7 @@ - (void)clearSubModel {
- (DoricViewNode *)subNodeWithViewId:(NSString *)viewId { - (DoricViewNode *)subNodeWithViewId:(NSString *)viewId {
return nil; return nil;
} }
- (void)requestLayout {
[self.view setNeedsLayout];
}
@end @end