Skip to content

Commit

Permalink
updated sample app to use didLoadElements delegate (#1473)
Browse files Browse the repository at this point in the history
  • Loading branch information
jwoo-msft authored and Gilles Khouzam committed May 21, 2018
1 parent e941b49 commit b94e4e5
Showing 1 changed file with 8 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -218,14 +218,6 @@ - (void)update:(NSString *) jsonStr
[self.curView removeFromSuperview];

self.curView = ad;
[_scrView addSubview:ad];
UIView *view = self.curView;
view.translatesAutoresizingMaskIntoConstraints = NO;

[NSLayoutConstraint constraintWithItem:ad attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:_scrView attribute:NSLayoutAttributeTop multiplier:1.0 constant:0].active = YES;
[NSLayoutConstraint constraintWithItem:ad attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:_scrView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0].active = YES;
[NSLayoutConstraint constraintWithItem:ad attribute:NSLayoutAttributeLeading relatedBy:NSLayoutRelationEqual toItem:_scrView attribute:NSLayoutAttributeLeading multiplier:1.0 constant:0].active = YES;
[NSLayoutConstraint constraintWithItem:ad attribute:NSLayoutAttributeTrailing relatedBy:NSLayoutRelationEqual toItem:_scrView attribute:NSLayoutAttributeTrailing multiplier:1.0 constant:0].active = YES;
}
}

Expand Down Expand Up @@ -291,7 +283,14 @@ - (void)didFetchHttpRequest:(NSURLRequest *)request

- (void)didLoadElements
{
NSLog(@"didLoadElements");
[_scrView addSubview:self.curView];
UIView *view = self.curView;
view.translatesAutoresizingMaskIntoConstraints = NO;

[NSLayoutConstraint constraintWithItem:view attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:_scrView attribute:NSLayoutAttributeTop multiplier:1.0 constant:0].active = YES;
[NSLayoutConstraint constraintWithItem:view attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:_scrView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0].active = YES;
[NSLayoutConstraint constraintWithItem:view attribute:NSLayoutAttributeLeading relatedBy:NSLayoutRelationEqual toItem:_scrView attribute:NSLayoutAttributeLeading multiplier:1.0 constant:0].active = YES;
[NSLayoutConstraint constraintWithItem:view attribute:NSLayoutAttributeTrailing relatedBy:NSLayoutRelationEqual toItem:_scrView attribute:NSLayoutAttributeTrailing multiplier:1.0 constant:0].active = YES;
}

- (void)registerForKeyboardNotifications
Expand Down

0 comments on commit b94e4e5

Please sign in to comment.