WEB开发网
开发学院手机开发iPhone 开发 iphone开发入门教程 阅读

iphone开发入门教程

 2010-12-18 08:05:22 来源:WEB开发网   
核心提示:(id)sender;20 - (IBAction) backgroundTap: (id)sender;21 22 @endHelloiPhoneViewController.m1 // 2 // HelloiPhoneViewController.m 3 // HelloiPhone 4 // 5 // Creat
(id)sender;20 - (IBAction) backgroundTap: (id)sender;21 22 @end

HelloiPhoneViewController.m

1 // 2 // HelloiPhoneViewController.m 3 // HelloiPhone 4 // 5 // Created by Elf Sundae on 11/4/10. 6 // Copyright 2010 Elf.Sundae(at)Gmail.com. All rights reserved. 7 // 8 9 #import "HelloiPhoneViewController.h"10 11 @implementation HelloiPhoneViewController12 13 @synthesize textField;14 15 - (IBAction) buttonPressed: (id)sender16 {17 UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Hello,iPhone!" 18 message:self.textField.text 19 delegate:nil 20 cancelButtonTitle:@"OK!" 21 otherButtonTitles:nil];22 [alert show];23 [alert release];24 }25 26 - (IBAction) textFieldDoneEditing: (id)sender27 {28 // 取消textField第一响应者状态29 [sender resignFirstResponder];30 }31 32 // 通过触摸屏幕关闭键盘33 - (IBAction) backgroundTap: (id)sender34 {35 // 在非第一响应者控件上调用resignFirstResponder是绝对安全的。36 // 因此可以放心的对所有textField调用resignFirstResponder37 [textField resignFirstResponder];38 }39 - (void)didReceiveMemoryWarning {40 // Releases the view if it doesn't have a superview.41 [super didReceiveMemoryWarning];42 43 // Release any cached data, images, etc that aren't in use.44 }45 46 - (void)viewDidUnload {47 // Release any retained subviews of the main view.48 // e.g. self.myOutlet = nil;49 self.textField = nil;50 }51 52 53 - (void)dealloc {54 [textField release];55 [super dealloc];56 }57 58 @end

上一页  1 2 3 4 

Tags:iphone 开发 入门教程

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接