第一次接触ios开发 徘徊在是从object-c 还是swift学起呢 其实都无所谓了 语法不同而已 对于新学者来说可以 了解ios开发环境和开发过程才是重要的
所以改成iso开发学习了
修改程序图标
默认的图标是白色网格的 为了增加程序的趣味性通常我们会修改图标的
准备57*57的PNG图标 app-icon.app
info.plist 文件下 右键Add Row 添加一条记录 key:Icon file Type:String value:app-icon.app
command +R 运行你的程序 在 ios Simulator 中选择Hardware Home 回到主屏幕可以看到我们app的图标了
熟悉Xcode的快捷键还是很有必要的(列出比较实用的几个)//可以Xcode-》Preferences-》Key Bingings查看修改快捷键
注释 command+/
文件首行 command+上箭头
文件末 command+下箭头
行首 command+左箭头
行末 command+右箭头
删除此行光标前所有内容 control+delete
左缩进 command+[
右缩进 command+]
项目中查找 command+shift+F
查找下一个 command+g
查找上一个 command+shift+g
Step Into (F7):单步跟进
Step Over (F6):单步跳过
Step Out (F8):单步跳出
cmd+~,就是tab上面一个键 快速切换两个项
mac book 回到桌面快捷键 1、五个手指向外 2、fn+F3
下面开始第一个demo程序 :三个插件 从上倒下依次位 文本框 text、表单label、按钮 button ,在text输入文字 点击button 修改label显示的文字为text中的文字。
1 在“Welcome to Xcode”窗口中,单击“Create a new Xcode project”,或选取“File”→
“New”→“New project”。Xcode 将打开一个新窗口并显示对话框, 从中选
取一个模板。
2 左边的 iOS 部分选择“Application”,选择“Single View Application”,
然后单击“Next” 项目名称:simpViewOc ,结构如图
程序清单
ViewController.h
#import <UIKit/UIKit.h>
@interface ViewController :UIViewController <UITextFieldDelegate>
@property (copy,nonatomic)NSString *userName;
@end
ViewController.m
#import "ViewController.h"
@interface ViewController ()
@property (weak, nonatomic) IBOutlet UITextField *textField;
@property (weak, nonatomic) IBOutlet UILabel *label;
- (IBAction)changeGreeting:(id)sender;
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (BOOL) textFieldShouldReturn:(UITextField *) theTextField{
if(theTextField == self.textField){
[theTextField resignFirstResponder];
}
return YES;
}
- (IBAction)changeGreeting:(id)sender {
self.userName = self.textField.text;
NSString *nameString = self.userName;
if([nameString length] == 0 ){
nameString =@"World";
}
NSString *greeting = [[NSString alloc] initWithFormat:@"Hello , %@!",nameString];
self.label.text = greeting;
}
@end
具体的操作可以看 《iOS+7+iPhone+iPad应用开发技术详解》一文中的介绍
最近在看 <<Objective-C 基础教程(第2版)>> 一书.....