Skip to content

Commit

Permalink
* [ios] fix list delete issue
Browse files Browse the repository at this point in the history
  • Loading branch information
cxfeng1 committed Jun 16, 2016
1 parent e3cd91b commit 579b720
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 29 deletions.
20 changes: 13 additions & 7 deletions ios/sdk/WeexSDK/Sources/Component/WXListComponent.m
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion ios/sdk/WeexSDK/Sources/Manager/WXComponentManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -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){
Expand Down
2 changes: 1 addition & 1 deletion ios/sdk/WeexSDK/Sources/Utility/WXConvert.m
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
45 changes: 25 additions & 20 deletions ios/sdk/WeexSDK/Sources/Utility/WXUtility.m
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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

0 comments on commit 579b720

Please sign in to comment.