Skip to content

Instantly share code, notes, and snippets.

@pegli
Created August 28, 2013 18:29
Show Gist options
  • Save pegli/6369504 to your computer and use it in GitHub Desktop.
Save pegli/6369504 to your computer and use it in GitHub Desktop.
label overlay example
// open a single window
var win = Ti.UI.createWindow({
backgroundColor:'white'
});
// TODO: write your module tests here
var OverlayTest = require('com.obscure.overlaytest');
Ti.API.info("module is => " + OverlayTest);
var view = OverlayTest.createDerpView({
top: 10,
left: 10,
width: 100,
height: 100,
backgroundColor: 'red'
});
win.add(view);
win.open();
#import "ComObscureOverlaytestDerpView.h"
@implementation ComObscureOverlaytestDerpView
- (void)initializeState
{
label = [[UILabel alloc] initWithFrame:CGRectZero];
label.text = @"hello, world!";
label.backgroundColor = [UIColor greenColor];
[self addSubview:label];
}
- (void)frameSizeChanged:(CGRect)frame bounds:(CGRect)bounds
{
[super frameSizeChanged:frame bounds:bounds];
[TiUtils setView:label positionRect:CGRectMake(5, 5, bounds.size.width - 10, bounds.size.height - 10)];
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment