diff --git a/ios/sdk/WeexSDK/Sources/Component/WXListComponent.m b/ios/sdk/WeexSDK/Sources/Component/WXListComponent.m index c48a2c5b0f..bd8ff7bbb0 100644 --- a/ios/sdk/WeexSDK/Sources/Component/WXListComponent.m +++ b/ios/sdk/WeexSDK/Sources/Component/WXListComponent.m @@ -149,7 +149,12 @@ - (void)cellDidLayout:(WXCellComponent *)cell WXAssert(indexPath, @"Laid out cell:%@ has not been inserted to cell list before", cell); if (indexPath.row == 0) { - cell.absolutePosition = CGPointZero; + if (_tableView.tableHeaderView) { + cell.absolutePosition = CGPointMake(0, _tableView.tableHeaderView.frame.size.height); + } else { + cell.absolutePosition = CGPointZero; + } + } else { WXCellComponent *previousCell = _cellComponents[indexPath.row - 1]; CGPoint previousCellPostion = previousCell.absolutePosition; @@ -246,18 +251,19 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N { static NSString *reuseIdentifier = @"WXTableViewCell"; - WXCellComponent *cell = _cellComponents[indexPath.row]; - if (cell.scope.length > 0) { - // reuseIdentifier = cell.scope; - } - - UITableViewCell *cellView = [_tableView dequeueReusableCellWithIdentifier:reuseIdentifier]; + UITableViewCell *cellView = [_tableView cellForRowAtIndexPath:indexPath]; if (!cellView) { cellView = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:reuseIdentifier]; cellView.backgroundColor = [UIColor clearColor]; } else { } + WXCellComponent *cell = [_cellComponents wx_safeObjectAtIndex:indexPath.row]; + + if (!cell) { + return cellView; + } + if (cell.view.superview == cellView.contentView) { return cellView; } diff --git a/ios/sdk/WeexSDK/Sources/Manager/WXComponentManager.m b/ios/sdk/WeexSDK/Sources/Manager/WXComponentManager.m index 17971ef812..7bca12253b 100644 --- a/ios/sdk/WeexSDK/Sources/Manager/WXComponentManager.m +++ b/ios/sdk/WeexSDK/Sources/Manager/WXComponentManager.m @@ -361,7 +361,7 @@ - (void)createFinish WXComponent *root = [_indexDict objectForKey:WX_SDK_ROOT_REF]; WXSDKInstance *instance = self.weexInstance; [self _addUITask:^{ - UIView *rootView = root.view; + UIView *rootView = instance.rootView; [instance finishPerformance]; if(instance.renderFinish){ diff --git a/ios/sdk/WeexSDK/Sources/Utility/WXConvert.m b/ios/sdk/WeexSDK/Sources/Utility/WXConvert.m index dd4d8eb751..fc69a3d9dd 100644 --- a/ios/sdk/WeexSDK/Sources/Utility/WXConvert.m +++ b/ios/sdk/WeexSDK/Sources/Utility/WXConvert.m @@ -54,7 +54,7 @@ + (NSString *)NSString:(id)value if([value isKindOfClass:[NSString class]]){ return value; } else if([value isKindOfClass:[NSNumber class]]){ - return [NSString stringWithFormat:@"%f", [value floatValue]]; + return [((NSNumber *)value) stringValue]; } else { WXLogError(@"Convert Error:%@ can not be converted to string", value); } diff --git a/ios/sdk/WeexSDK/Sources/Utility/WXUtility.m b/ios/sdk/WeexSDK/Sources/Utility/WXUtility.m index 21bdd9f5cf..c875d666f1 100644 --- a/ios/sdk/WeexSDK/Sources/Utility/WXUtility.m +++ b/ios/sdk/WeexSDK/Sources/Utility/WXUtility.m @@ -80,26 +80,6 @@ CGSize WXScreenSize(void) return [UIScreen mainScreen].bounds.size; } -CGFloat WXScreenResizeRadio(void) -{ - static CGFloat resizeScale; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - CGSize size = WXScreenSize(); - CGFloat deviceWidth; - if (size.width > size.height) { - // Landscape - deviceWidth = size.height; - } else { - deviceWidth = size.width; - } - - resizeScale = deviceWidth / WXDefaultScreenWidth; - }); - - return resizeScale; -} - CGFloat WXRoundPixelValue(CGFloat value) { CGFloat scale = WXScreenScale(); @@ -386,4 +366,29 @@ + (void)addStatTrack:(NSString *)appName [task resume]; } +CGFloat WXScreenResizeRadio(void) +{ + return [WXUtility screenResizeScale]; +} + ++ (CGFloat)screenResizeScale +{ + static CGFloat resizeScale; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + CGSize size = WXScreenSize(); + CGFloat deviceWidth; + if (size.width > size.height) { + // Landscape + deviceWidth = size.height; + } else { + deviceWidth = size.width; + } + + resizeScale = deviceWidth / WXDefaultScreenWidth; + }); + + return resizeScale; +} + @end