
Untitled
By: a guest on
Aug 11th, 2012 | syntax:
None | size: 0.84 KB | hits: 9 | expires: Never
How do I put this UILabel code outside of my AppDelegate?
CGRect frame = CGRectMake(10, 10, 300, 25);
UILabel *helloLabel = [UILabel new];
[helloLabel setFrame:frame];
helloLabel.text = @"Hello iPhone!";
[self.window addSubview:helloLabel];
[MyOtherClass addHello];
+ (void) addHello {
CGRect frame = CGRectMake(10, 10, 300, 25);
UILabel *helloLabel = [UILabel new];
[helloLabel setFrame:frame];
helloLabel.text = @"Hello iPhone!";
UIWindow *window = [[UIApplication sharedApplication] keyWindow];
[window addSubview:helloLabel];
}
[MyOtherClass addHelloWithWindow:self.window];
+ (void) addHelloWithWindow:(UIWindow *)window
{
CGRect frame = CGRectMake(10, 10, 300, 25);
UILabel *helloLabel = [UILabel new];
[helloLabel setFrame:frame];
helloLabel.text = @"Hello iPhone!";
[window addSubview:helloLabel];
}