Skip to content

Commit

Permalink
[css] Added new properties to sample app
Browse files Browse the repository at this point in the history
  • Loading branch information
Max Metral committed Feb 14, 2013
1 parent f817c43 commit df26e12
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 4 deletions.
2 changes: 2 additions & 0 deletions examples/css/CSSDemo/RootViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
UIView* _backgroundView;
UIActivityIndicatorView* _activityIndicator;
UILabel* _testLabel;
UILabel* _bottomLabel;
UILabel* _rightMiddleLabel;
}

@end
22 changes: 19 additions & 3 deletions examples/css/CSSDemo/RootViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -72,18 +72,34 @@ - (void)loadView {
_testLabel = [[UILabel alloc] init];
_testLabel.text = @"Chameleon changes skins in real time.\n\nStop compiling.\nStart building.";
_testLabel.frame = NIRectShift(_backgroundView.bounds, 0, CGRectGetMaxY(_activityIndicator.frame));

_rightMiddleLabel = [[UILabel alloc] init];
_rightMiddleLabel.text = @"Right Middle Label";

_bottomLabel = [[UILabel alloc] init];
_bottomLabel.text = @"Bottom Left Label";

[self.view addSubview:_rightMiddleLabel];
[self.view addSubview:_backgroundView];
[self.view addSubview:_bottomLabel];
[_backgroundView addSubview:_activityIndicator];
[_backgroundView addSubview:_testLabel];

// Register our views with the DOM.
[_dom registerView:self.view withCSSClass:@"background"];
[_dom registerView:_activityIndicator];
[_dom registerView:_testLabel];
[_dom registerView:_backgroundView withCSSClass:@"noticeBox"];
[_dom registerView:_rightMiddleLabel withCSSClass:@"rightMiddleLabel"];
[_dom registerView:_bottomLabel withCSSClass:@"bottomLabel"];

[self.view addSubview:_backgroundView];
[_backgroundView addSubview:_activityIndicator];
[_backgroundView addSubview:_testLabel];
}

-(void)viewWillLayoutSubviews
{
[super viewWillLayoutSubviews];
[_dom refresh];
}

///////////////////////////////////////////////////////////////////////////////////////////////////
- (void)viewDidUnload {
Expand Down
21 changes: 20 additions & 1 deletion examples/css/CSSDemo/resources/css/root/root.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,12 @@ UINavigationBar {

.noticeBox {
background-color: rgba(32, 32, 32, 0.5);
border-radius: 10px;
border-radius: 20px;
border: none;
width: -300px;
height: -400px;
top: 10px;
-ios-halign: center;
}

UIActivityIndicatorView {
Expand All @@ -27,3 +31,18 @@ UILabel {
text-align: center;
font-size: 17;
}

.rightMiddleLabel
{
width: auto;
height: auto;
-ios-valign: middle;
-ios-halign: right;
}

.bottomLabel
{
width: auto;
height: auto;
bottom: 0px;
}

0 comments on commit df26e12

Please sign in to comment.