iphone---MyfistLabel
来源:互联网 发布:怎么招募淘宝客 编辑:程序博客网 时间:2024/05/16 10:31
//
// hello.h
// MyFirstLabel
//
//
// Copyright (c) 2012年 __MyCompanyName__. All rights reserved.
//
#import<UIKit/UIKit.h>
@interface hello :UIViewController
{
UILabel* _label;
UIButton* _button;
}
@property(nonatomic,retain)UILabel* _label;
@property(nonatomic,retain)UIButton* button;
@end
//
// hello.m
// MyFirstLabel
//
//
// Copyright (c) 2012年 __MyCompanyName__. All rights reserved.
//
#import"hello.h"
@implementation hello
@synthesize button=_button;
@synthesize _label;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)didReceiveMemoryWarning
{
// Releases the view if it doesn't have a superview.
[superdidReceiveMemoryWarning];
// Release any cached data, images, etc that aren't in use.
}
#pragma mark - View lifecycle
/*
// Implement loadView to create a view hierarchy programmatically, without using a nib.
- (void)loadView
{
}
*/
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad
{
// self.view.backgroundColor = [UIColor blueColor];
_label= [[UILabelalloc]initWithFrame:CGRectMake(50,20, 150, 80)];
_label.text=@"I love you!";
_label.textAlignment=UITextAlignmentCenter;
_label.textColor=[UIColorredColor];
_label.font=[UIFontsystemFontOfSize:30];
[self.viewaddSubview:_label];
_button=[UIButtonbuttonWithType:UIButtonTypeRoundedRect];
_button.frame=CGRectMake(100,100, 100, 60);
[_buttonsetTitle:@"love"forState:UIControlStateNormal];
[_buttonsetTitleColor:[UIColorredColor] forState:UIControlStateNormal];
[_buttonsetBackgroundColor:[UIColorgreenColor]];
_button.alpha = 0.5f;
[self.viewaddSubview:_button];
[superviewDidLoad];
}
- (void)viewDidUnload
{
[superviewDidUnload];
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
@end
//
// AppDelegate.h
// MyFirstLabel
//
//
// Copyright (c) 2012年 __MyCompanyName__. All rights reserved.
//
#import<UIKit/UIKit.h>
@classhello;
@interface AppDelegate :UIResponder <UIApplicationDelegate>
{
hello* _h;
}
@property(nonatomic,retain)hello* h;
@property (strong,nonatomic) UIWindow *window;
@end
//
// AppDelegate.m
// MyFirstLabel
//
//
// Copyright (c) 2012年 __MyCompanyName__. All rights reserved.
//
#import"AppDelegate.h"
#import"hello.h"
@implementation AppDelegate
@synthesize window =_window;
@synthesize h=_h;
- (void)dealloc
{
[_windowrelease];
[super dealloc];
}
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[[UIWindowalloc] initWithFrame:[[UIScreenmainScreen] bounds]]autorelease];
// Override point for customization after application launch.
self.window.backgroundColor = [UIColorwhiteColor];
hello* he=[[hello alloc]init];
self.h=he;
// self.window.rootViewController = self.h;
[self.windowaddSubview:self.h.view];
[self.windowmakeKeyAndVisible];
return YES;
}
- (void)applicationWillResignActive:(UIApplication *)application
{
/*
Sent when the application is aboutto move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
*/
}
- (void)applicationDidEnterBackground:(UIApplication *)application
{
/*
Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
*/
}
- (void)applicationWillEnterForeground:(UIApplication *)application
{
/*
Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
*/
}
- (void)applicationDidBecomeActive:(UIApplication *)application
{
/*
Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
*/
}
- (void)applicationWillTerminate:(UIApplication *)application
{
/*
Called when the application is about to terminate.
Save data if appropriate.
See also applicationDidEnterBackground:.
*/
}
@end
- iphone---MyfistLabel
- IPhone
- iPhone
- iPhone
- iphone
- iphone
- iphone
- iphone
- iphone
- iPhone
- iphone
- iPhone
- iphone
- iphone
- iPhone
- iphone--------------------------------------
- Iphone
- iphone
- 利用MapReduce解决在海量数据中求Top K个数
- 如何知道某个端口有没有被占用
- c++ 入门步骤
- DENX U-Boot及Linux使用手册
- DirectX9 SDK Samples(15) OptimizedMesh Sample
- iphone---MyfistLabel
- java新手求职深圳
- flex4.5 spark datagrid itemrenderer
- Android NDK之二:创建NativeActivity
- TCP循环服务器 UDP循环服务器 TCP并发服务器
- 论文阅读——R树
- 【算法入门】深度优先搜索(DFS)
- 使用Ext Form自动绑定Html中的Form元素
- 史上最强第2代智能CPU核芯显卡性能测试