Beginning IOS 7 Development Exploring the IOS SDK

目前使用的是Objective-C,用这本书,简单记录一下

第一章,图书简介

第二章,简要介绍使用xcode,建一个HelloWorld工程,并添加app应用图片

第三章,讲解Outlets和Actions是什么,和一些比较细节的内容,比如

1 @interface MyViewController : UIViewController
2 {
3 UIButton *myButton;
4 }
5 @property (weak, nonatomic) UIButton *myButton;
6 @end

当Apple从GCC编译器切换到使用LLVM以后,不需要先声明UIButton *myButton 再赋属性了,因为LLVM可以自动创建

还推荐了objective-c的开发者文档

https://developer.apple.com/library/ios/documentation/Cocoa/Conceptual/ProgrammingWithObjectiveC

1 - (IBAction)doSomething:(id)sender;
2 - (IBAction)doSomething;
3 - (IBAction)doSomething:(id)sender forEvent:(UIEvent*)event;

可以通过sender参数,得知是谁被点击

最后一个 - (IBAction)doSomething:(id)sender forEvent:(UIEvent*)event;没有什么用

书中的实例 Button Fun:

 1 - (IBAction)buttonPressed:(UIButton *)sender {
2 NSString *title = [sender titleForState:UIControlStateNormal];
3 NSString *plainText = [NSString stringWithFormat:@"%@ button pressed.", title];
4 // _statusLabel.text = plainText;
5 NSMutableAttributedString *styledText = [[NSMutableAttributedString alloc]
6 initWithString:plainText];
7 NSDictionary *attributes =
8 @{
9 NSFontAttributeName : [UIFont boldSystemFontOfSize:_statusLabel.font.pointSize]
10 };
11
12 NSRange nameRange = [plainText rangeOfString:title];
13
14 [styledText setAttributes:attributes range:nameRange];
15 _statusLabel.attributedText = styledText;
16 }

基本上,第三章的内容概括来说,把ARC,内存管理这些想要了解的内容都推给了开发者官方文档

http://developer.apple.com/library/ios/#releasenotes/ObjectiveC/RN-TransitioningToARC/

http://developer.apple.com/library/ios/#documentation/Cocoa/Conceptual/MemoryMgmt/

最后面,

Looking at the Application Delegate

 1 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
2 // Override point for customization after application launch.
3 return YES;
4 }
5
6 - (void)applicationWillResignActive:(UIApplication *)application {
7 // Sent when the application is about to 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.
8 // 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.
9 }
10
11 - (void)applicationDidEnterBackground:(UIApplication *)application {
12 // 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.
13 // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
14 }
15
16 - (void)applicationWillEnterForeground:(UIApplication *)application {
17 // 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.
18 }
19
20 - (void)applicationDidBecomeActive:(UIApplication *)application {
21 // 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.
22 }
23
24 - (void)applicationWillTerminate:(UIApplication *)application {
25 // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
26 }

不描述了,可以加断点调试一下

最新文章

  1. python学习笔记系列----(三)数据结构
  2. [转]Spring 注解总结
  3. 关于CSS动画效果的图片展示
  4. apache-tomcat-5.5.35.搭建实战
  5. php请求URL中的参数有空格
  6. ReactDom.render和React.render的区别
  7. 编程计算并输出1~n之间所有素数之和
  8. Spring MVC 解读——View,ViewResolver(转)
  9. 如何生成Azure SAS Token
  10. 关于SCSI/SATA/IDE硬盘的比较
  11. 疑似CPU或者内存故障导致进程崩溃
  12. linux 命令ls
  13. windows下使用git和github建立远程仓库
  14. 给定一个只包含正整数的非空数组,返回该数组中重复次数最多的前N个数字 ,返回的结果按重复次数从多到少降序排列(N不存在取值非法的情况)
  15. python3学习笔记七(字典)
  16. UVA1451 Average
  17. 生成树协议(STP)
  18. Django-管理站点重写admin模板
  19. python seaborn 画图
  20. 小米2s线刷出现remote: partition table doesn't exist

热门文章

  1. 自定义StringByteLength
  2. ubuntu下升级gcc11环境
  3. function 和mapped function的区别
  4. kail 系统更新
  5. goalng 将字符串转化成整数后取余
  6. 硬件IIC的7位从机地址查询方式读写参考代码
  7. dropbear 2019.78 Installing to target......Running build_buildroot failed!
  8. 跨平台Docker篇
  9. GPT和MBR分区格式
  10. Pytorch实战学习(八):基础RNN