iOS:change the way created item view.
This commit is contained in:
parent
05655972e3
commit
f75a6f8071
@ -119,10 +119,10 @@ public class NavBarPlugin extends DoricJavaPlugin {
|
|||||||
final JSObject jsObject = decoder.decode().asObject();
|
final JSObject jsObject = decoder.decode().asObject();
|
||||||
getDoricContext().getDriver().asyncCall(new Callable<Object>() {
|
getDoricContext().getDriver().asyncCall(new Callable<Object>() {
|
||||||
@Override
|
@Override
|
||||||
public Object call() throws Exception {
|
public Object call() {
|
||||||
String viewId = jsObject.getProperty("id").asString().value();
|
String viewId = jsObject.getProperty("id").asString().value();
|
||||||
String type = jsObject.getProperty("type").asString().value();
|
String type = jsObject.getProperty("type").asString().value();
|
||||||
ViewNode node = ViewNode.create(getDoricContext(), type);
|
ViewNode<?> node = ViewNode.create(getDoricContext(), type);
|
||||||
node.setId(viewId);
|
node.setId(viewId);
|
||||||
node.init(new FrameLayout.LayoutParams(0, 0));
|
node.init(new FrameLayout.LayoutParams(0, 0));
|
||||||
node.blend(jsObject.getProperty("props").asObject());
|
node.blend(jsObject.getProperty("props").asObject());
|
||||||
@ -162,10 +162,10 @@ public class NavBarPlugin extends DoricJavaPlugin {
|
|||||||
final JSObject jsObject = decoder.decode().asObject();
|
final JSObject jsObject = decoder.decode().asObject();
|
||||||
getDoricContext().getDriver().asyncCall(new Callable<Object>() {
|
getDoricContext().getDriver().asyncCall(new Callable<Object>() {
|
||||||
@Override
|
@Override
|
||||||
public Object call() throws Exception {
|
public Object call() {
|
||||||
String viewId = jsObject.getProperty("id").asString().value();
|
String viewId = jsObject.getProperty("id").asString().value();
|
||||||
String type = jsObject.getProperty("type").asString().value();
|
String type = jsObject.getProperty("type").asString().value();
|
||||||
ViewNode node = ViewNode.create(getDoricContext(), type);
|
ViewNode<?> node = ViewNode.create(getDoricContext(), type);
|
||||||
node.setId(viewId);
|
node.setId(viewId);
|
||||||
node.init(new FrameLayout.LayoutParams(0, 0));
|
node.init(new FrameLayout.LayoutParams(0, 0));
|
||||||
node.blend(jsObject.getProperty("props").asObject());
|
node.blend(jsObject.getProperty("props").asObject());
|
||||||
@ -205,10 +205,10 @@ public class NavBarPlugin extends DoricJavaPlugin {
|
|||||||
final JSObject jsObject = decoder.decode().asObject();
|
final JSObject jsObject = decoder.decode().asObject();
|
||||||
getDoricContext().getDriver().asyncCall(new Callable<Object>() {
|
getDoricContext().getDriver().asyncCall(new Callable<Object>() {
|
||||||
@Override
|
@Override
|
||||||
public Object call() throws Exception {
|
public Object call() {
|
||||||
String viewId = jsObject.getProperty("id").asString().value();
|
String viewId = jsObject.getProperty("id").asString().value();
|
||||||
String type = jsObject.getProperty("type").asString().value();
|
String type = jsObject.getProperty("type").asString().value();
|
||||||
ViewNode node = ViewNode.create(getDoricContext(), type);
|
ViewNode<?> node = ViewNode.create(getDoricContext(), type);
|
||||||
node.setId(viewId);
|
node.setId(viewId);
|
||||||
node.init(new FrameLayout.LayoutParams(0, 0));
|
node.init(new FrameLayout.LayoutParams(0, 0));
|
||||||
node.blend(jsObject.getProperty("props").asObject());
|
node.blend(jsObject.getProperty("props").asObject());
|
||||||
|
@ -346,7 +346,7 @@ - (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collection
|
|||||||
[collectionView registerClass:[DoricFlowLayoutViewCell class] forCellWithReuseIdentifier:identifier];
|
[collectionView registerClass:[DoricFlowLayoutViewCell class] forCellWithReuseIdentifier:identifier];
|
||||||
DoricFlowLayoutViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:identifier forIndexPath:indexPath];
|
DoricFlowLayoutViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:identifier forIndexPath:indexPath];
|
||||||
if (!cell.viewNode) {
|
if (!cell.viewNode) {
|
||||||
DoricFlowLayoutItemNode *itemNode = [[DoricFlowLayoutItemNode alloc] initWithContext:self.doricContext];
|
DoricFlowLayoutItemNode *itemNode = (DoricFlowLayoutItemNode *) [DoricViewNode create:self.doricContext withType:@"FlowLayoutItem"];
|
||||||
[itemNode initWithSuperNode:self];
|
[itemNode initWithSuperNode:self];
|
||||||
cell.viewNode = itemNode;
|
cell.viewNode = itemNode;
|
||||||
[cell.contentView addSubview:itemNode.view];
|
[cell.contentView addSubview:itemNode.view];
|
||||||
|
@ -159,7 +159,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
|
|||||||
DoricTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:reuseId ?: @"doriccell"];
|
DoricTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:reuseId ?: @"doriccell"];
|
||||||
if (!cell) {
|
if (!cell) {
|
||||||
cell = [[DoricTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:reuseId ?: @"doriccell"];
|
cell = [[DoricTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:reuseId ?: @"doriccell"];
|
||||||
DoricListItemNode *listItemNode = [[DoricListItemNode alloc] initWithContext:self.doricContext];
|
DoricListItemNode *listItemNode = (DoricListItemNode *) [DoricViewNode create:self.doricContext withType:@"ListItem"];
|
||||||
[listItemNode initWithSuperNode:self];
|
[listItemNode initWithSuperNode:self];
|
||||||
cell.doricListItemNode = listItemNode;
|
cell.doricListItemNode = listItemNode;
|
||||||
cell.backgroundColor = [UIColor clearColor];
|
cell.backgroundColor = [UIColor clearColor];
|
||||||
|
@ -100,8 +100,8 @@ - (void)blendView:(UICollectionView *)view forPropName:(NSString *)name propValu
|
|||||||
|
|
||||||
- (void)afterBlended:(NSDictionary *)props {
|
- (void)afterBlended:(NSDictionary *)props {
|
||||||
bool needToScroll = (self.propLoop && !self.loop)
|
bool needToScroll = (self.propLoop && !self.loop)
|
||||||
|| (![self.renderPageFuncId isEqualToString: self.propRenderPageFuncId])
|
|| (![self.renderPageFuncId isEqualToString:self.propRenderPageFuncId])
|
||||||
|| (self.itemCount == 0 && self.propItemCount > 0);
|
|| (self.itemCount == 0 && self.propItemCount > 0);
|
||||||
|
|
||||||
// handle item count
|
// handle item count
|
||||||
if (self.itemCount != self.propItemCount) {
|
if (self.itemCount != self.propItemCount) {
|
||||||
@ -159,7 +159,7 @@ - (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collection
|
|||||||
NSDictionary *props = model[@"props"];
|
NSDictionary *props = model[@"props"];
|
||||||
DoricSliderViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"doricCell" forIndexPath:indexPath];
|
DoricSliderViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"doricCell" forIndexPath:indexPath];
|
||||||
if (!cell.doricSlideItemNode) {
|
if (!cell.doricSlideItemNode) {
|
||||||
DoricSlideItemNode *slideItemNode = [[DoricSlideItemNode alloc] initWithContext:self.doricContext];
|
DoricSlideItemNode *slideItemNode = (DoricSlideItemNode *) [DoricViewNode create:self.doricContext withType:@"SlideItem"];
|
||||||
[slideItemNode initWithSuperNode:self];
|
[slideItemNode initWithSuperNode:self];
|
||||||
cell.doricSlideItemNode = slideItemNode;
|
cell.doricSlideItemNode = slideItemNode;
|
||||||
[cell.contentView addSubview:slideItemNode.view];
|
[cell.contentView addSubview:slideItemNode.view];
|
||||||
|
Reference in New Issue
Block a user