//
// 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.
[super
didReceiveMemoryWarning];
// 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= [[UILabel
alloc]initWithFrame:CGRectMake(50,
20,
150, 80)];
_label.text=@"I love you!";
_label.textAlignment=UITextAlignmentCenter;
_label.textColor=[UIColor
redColor];
_label.font=[UIFont
systemFontOfSize:30];
[self.view
addSubview:_label];
_button=[UIButton
buttonWithType:UIButtonTypeRoundedRect];
_button.frame=CGRectMake(100,
100, 100,
60);
[_button
setTitle:@"love"
forState:UIControlStateNormal];
[_button
setTitleColor:[UIColor
redColor] forState:UIControlStateNormal];
[_button
setBackgroundColor:[UIColor
greenColor]];
_button.alpha =
0.5f;
[self.view
addSubview:_button];
[super
viewDidLoad];
}
- (void)viewDidUnload
{
[super
viewDidUnload];
// 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>
@class
hello;
@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
{
[_window
release];
[super
dealloc];
}
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary
*)launchOptions
{
self.window = [[[UIWindow
alloc] initWithFrame:[[UIScreen
mainScreen] bounds]]
autorelease];
// Override point for customization after application launch.
self.window.backgroundColor = [UIColor
whiteColor];
hello* he=[[hello
alloc]init];
self.h=he;
// self.window.rootViewController = self.h;
[self.window
addSubview:self.h.view];
[self.window
makeKeyAndVisible];
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
分享到:
相关推荐
netdisk_iPhone-2022-07-29-042850.ips
iphone-coverflow,iphone-coverflow,iphone-coverflow,iphone-coverflow,iphone-coverflow,iphone-coverflow,iphone-coverflow,iphone-coverflow,iphone-coverflow
C#读写iphone中的plist文件的代码,完整的工程文件
西蒙OpenGL ES 教程 IOS开发,ios技术文档,网络收集整理。西蒙iphone-OpenGL ES 教程,共13篇。第8、12章由于有更好的技术,所以被译者跳过
absinthe-win-2.0.4-iPhone-5.1.1-完美越狱
OpenSSL-for-iPhone-master.zip
这是做axure的时候可以用的iPhone各种界面。
iphone-plist-net source and Demo,iphone-plist-net是一个C#读写Plist文件的类库,iphone-plist-net源码及演示程序
iphone-14-pro-max-03405318-info
cocos2d-iphone-extensions-v0.1.3-Himi-ios-视频-iphone 【Cocos2d游戏开发之十四】音频与音效播放以及利用+Cocos2D-iPhone-Extensions嵌入Cocos2d进行视频播放! ...
iPhone-Explorer-v2-2.dmg,查看ios设备应用程序。
iphone-sdk-2.0-headers 别看的不大 我坚持了一天 1k 1k的下下来的
Apple - iPhone - 机型比较,iphone6 iphone5s and iphone5
Documents-iPhone-8.6.1-Support-Log.zip
iphone-keyChain保存数据 iphone-keyChain保存数据-官方demo
越狱助手.rar-终极-iphone-ios-越狱辅助工具-支持5.1.1
simple-iphone-image-processing.zipIOS应用例子源码下载simple-iphone-image-processing.zipIOS应用例子源码下载 1.适合学生学习研究参考 2.适合个人学习研究参考 3.适合公司开发项目技术参考
Beginning-iphone-games-development PART 2
ios系统下禁止视频全屏播放
iPhone-OpenGL-ES-Tutorial-Series-master iphone opengl es 源码