Enviar búsqueda
Cargar
I os 02
•
0 recomendaciones
•
458 vistas
信嘉 陳
Seguir
Denunciar
Compartir
Denunciar
Compartir
1 de 54
Recomendados
I os 05
I os 05
信嘉 陳
15 Subclassing UITableViewCell
15 Subclassing UITableViewCell
Tom Fan
I os 09
I os 09
信嘉 陳
I os 08
I os 08
信嘉 陳
Js的国(转载)
Js的国(转载)
Leo Hui
用Jquery实现拖拽层
用Jquery实现拖拽层
yiditushe
Php & Mysql
Php & Mysql
chuyenyin
C語言結構與串列
C語言結構與串列
吳錫修 (ShyiShiou Wu)
Más contenido relacionado
La actualidad más candente
JavaScript 教程
JavaScript 教程
Bobby Zhou
面向对象的Js培训
面向对象的Js培训
yiditushe
jQuery 選取器解析
jQuery 選取器解析
Kingsley Zheng
C語言應用前置處理
C語言應用前置處理
吳錫修 (ShyiShiou Wu)
C語言列舉與聯合
C語言列舉與聯合
吳錫修 (ShyiShiou Wu)
Python分支作業
Python分支作業
吳錫修 (ShyiShiou Wu)
Vb簡介
Vb簡介
二呆 林
C++11 smart pointers
C++11 smart pointers
chchwy Chang
C語言標準輸出入函式
C語言標準輸出入函式
吳錫修 (ShyiShiou Wu)
Standford 2015 iOS讀書會 week2: 1. Applying MVC 2. More Swift and Foundation Fra...
Standford 2015 iOS讀書會 week2: 1. Applying MVC 2. More Swift and Foundation Fra...
彼得潘 Pan
jQuery源码学习
jQuery源码学习
fangdeng
Python 迴圈作業
Python 迴圈作業
吳錫修 (ShyiShiou Wu)
07 View Controllers
07 View Controllers
Tom Fan
小谈Javascript设计模式
小谈Javascript设计模式
Adam Lu
Ch10
Ch10
Alisha Smile
Python元組,字典,集合
Python元組,字典,集合
吳錫修 (ShyiShiou Wu)
C語言陣列與字串
C語言陣列與字串
吳錫修 (ShyiShiou Wu)
Javascript之昨是今非
Javascript之昨是今非
Tony Deng
Python基本資料運算
Python基本資料運算
吳錫修 (ShyiShiou Wu)
Keep your code clean
Keep your code clean
macrochen
La actualidad más candente
(20)
JavaScript 教程
JavaScript 教程
面向对象的Js培训
面向对象的Js培训
jQuery 選取器解析
jQuery 選取器解析
C語言應用前置處理
C語言應用前置處理
C語言列舉與聯合
C語言列舉與聯合
Python分支作業
Python分支作業
Vb簡介
Vb簡介
C++11 smart pointers
C++11 smart pointers
C語言標準輸出入函式
C語言標準輸出入函式
Standford 2015 iOS讀書會 week2: 1. Applying MVC 2. More Swift and Foundation Fra...
Standford 2015 iOS讀書會 week2: 1. Applying MVC 2. More Swift and Foundation Fra...
jQuery源码学习
jQuery源码学习
Python 迴圈作業
Python 迴圈作業
07 View Controllers
07 View Controllers
小谈Javascript设计模式
小谈Javascript设计模式
Ch10
Ch10
Python元組,字典,集合
Python元組,字典,集合
C語言陣列與字串
C語言陣列與字串
Javascript之昨是今非
Javascript之昨是今非
Python基本資料運算
Python基本資料運算
Keep your code clean
Keep your code clean
Destacado
I os 06
I os 06
信嘉 陳
I os 14
I os 14
信嘉 陳
I os 07
I os 07
信嘉 陳
I os 03
I os 03
信嘉 陳
I os 15
I os 15
信嘉 陳
課程規畫
課程規畫
信嘉 陳
I os 16
I os 16
信嘉 陳
I os 11
I os 11
信嘉 陳
I os 04
I os 04
信嘉 陳
I os 10
I os 10
信嘉 陳
I os 13
I os 13
信嘉 陳
Destacado
(11)
I os 06
I os 06
I os 14
I os 14
I os 07
I os 07
I os 03
I os 03
I os 15
I os 15
課程規畫
課程規畫
I os 16
I os 16
I os 11
I os 11
I os 04
I os 04
I os 10
I os 10
I os 13
I os 13
Similar a I os 02
I os 01
I os 01
信嘉 陳
02 Objective-C
02 Objective-C
Tom Fan
09 UITableView and UITableViewController
09 UITableView and UITableViewController
Tom Fan
2016輕鬆開發自有網路地圖工作坊 進階班 0701
2016輕鬆開發自有網路地圖工作坊 進階班 0701
family
Javascript
Javascript
Ryan Chung
各種酷炫圖表繪製技術 Silverlight Toolkit 與 MS Chart 控制項大探索
各種酷炫圖表繪製技術 Silverlight Toolkit 與 MS Chart 控制項大探索
Chui-Wen Chiu
11 UINavigationController
11 UINavigationController
Tom Fan
Script with engine
Script with engine
Webrebuild
Backbone.js and MVW 101
Backbone.js and MVW 101
Jollen Chen
掌星 移动互联网开发笔记-Vol001
掌星 移动互联网开发笔记-Vol001
rainx1982
005
005
Stronger Shen
Android 智慧型手機程式設計
Android 智慧型手機程式設計
Kyle Lin
Free Marker中文文档
Free Marker中文文档
yiditushe
怎樣在 Flutter app 中使用 Google Maps
怎樣在 Flutter app 中使用 Google Maps
Weizhong Yang
KISSY for starter
KISSY for starter
yiming he
Backbone js and requirejs
Backbone js and requirejs
Chi-wen Sun
UIKit-Swift
UIKit-Swift
Ryan Chung
Unity遊戲程式設計 - 應用Sprite物件
Unity遊戲程式設計 - 應用Sprite物件
吳錫修 (ShyiShiou Wu)
01 A Simple iOS Application
01 A Simple iOS Application
Tom Fan
16 CoreData
16 CoreData
Tom Fan
Similar a I os 02
(20)
I os 01
I os 01
02 Objective-C
02 Objective-C
09 UITableView and UITableViewController
09 UITableView and UITableViewController
2016輕鬆開發自有網路地圖工作坊 進階班 0701
2016輕鬆開發自有網路地圖工作坊 進階班 0701
Javascript
Javascript
各種酷炫圖表繪製技術 Silverlight Toolkit 與 MS Chart 控制項大探索
各種酷炫圖表繪製技術 Silverlight Toolkit 與 MS Chart 控制項大探索
11 UINavigationController
11 UINavigationController
Script with engine
Script with engine
Backbone.js and MVW 101
Backbone.js and MVW 101
掌星 移动互联网开发笔记-Vol001
掌星 移动互联网开发笔记-Vol001
005
005
Android 智慧型手機程式設計
Android 智慧型手機程式設計
Free Marker中文文档
Free Marker中文文档
怎樣在 Flutter app 中使用 Google Maps
怎樣在 Flutter app 中使用 Google Maps
KISSY for starter
KISSY for starter
Backbone js and requirejs
Backbone js and requirejs
UIKit-Swift
UIKit-Swift
Unity遊戲程式設計 - 應用Sprite物件
Unity遊戲程式設計 - 應用Sprite物件
01 A Simple iOS Application
01 A Simple iOS Application
16 CoreData
16 CoreData
Más de 信嘉 陳
Processing 06
Processing 06
信嘉 陳
Processing 05
Processing 05
信嘉 陳
Processing 04
Processing 04
信嘉 陳
Processing 03
Processing 03
信嘉 陳
Processing 02
Processing 02
信嘉 陳
Processing 01
Processing 01
信嘉 陳
Processing 09
Processing 09
信嘉 陳
Processing 08
Processing 08
信嘉 陳
Processing 07
Processing 07
信嘉 陳
Google 街景
Google 街景
信嘉 陳
社群網站 Facebook
社群網站 Facebook
信嘉 陳
網路搜尋
網路搜尋
信嘉 陳
Más de 信嘉 陳
(12)
Processing 06
Processing 06
Processing 05
Processing 05
Processing 04
Processing 04
Processing 03
Processing 03
Processing 02
Processing 02
Processing 01
Processing 01
Processing 09
Processing 09
Processing 08
Processing 08
Processing 07
Processing 07
Google 街景
Google 街景
社群網站 Facebook
社群網站 Facebook
網路搜尋
網路搜尋
I os 02
1.
Class 02 iOS 應⽤用軟體設計
2.
課程⼤大綱 •
另⼀一種換圖的⽅方式 • QV003:多個按鈕,按下後顯⽰示不同的圖 • 學習⽂文字的顯⽰示 (UILabel) • QV002:按鈕顯⽰示不同的⽂文字 • Property & Synthesize • 由 UILable 查詢資料的查閱⽅方法 • QV058:數種顯⽰示資料的練習 • 隨機亂數。資料運算 • QV057:九九乘法 CAI 練習
3.
類似的寫法 (同⼀一個 UIImageView,更換圖⽚片內容)
4.
Project QV003 設定多個按鈕,按鈕後 顯⽰示出不同的圖 學習將圖⽚片置於畫⾯面
5.
ViewController.h #import <UIKit/UIKit.h> @interface ViewController
: UIViewController { IBOutlet UIImageView *imageView; } -(IBAction)btn1:(id)sender; -(IBAction)btn2:(id)sender; -(IBAction)btn3:(id)sender; @end
6.
ViewController.xib
要完成: (1)物件的連接 (2)事件與⽅方法的連接
7.
ViewController.m #import "ViewController.h" @implementation ViewController -(IBAction)btn1:(id)sender {
imageView.image = [UIImage imageNamed:@"pic1.png"]; } -(IBAction)btn2:(id)sender { imageView.image = [UIImage imageNamed:@"pic2.png"]; } -(IBAction)btn3:(id)sender { imageView.image = [UIImage imageNamed:@"pic3.png"]; } @end
8.
挑戰練習 • 如何⾃自訂圖⽚片按鈕 (UIButton)? •
就這樣的功能,能開發出怎樣的 App?
9.
學習⽂文字的顯⽰示
10.
程式內容很簡單
重點是學會 ⾃自⼰己能夠找到更多的功能
11.
範例:在畫⾯面上增加 UILabel
⽂文字
12.
Project QV002 基礎的練習 設定兩個 UIButton
及 ⼀一個 UILabel 各別按鈕按下後改變 標籤的⽂文字
13.
ViewController.h #import <UIKit/UIKit.h> @interface ViewController
: UIViewController { IBOutlet UILabel *myLabel; } @property (retain, nonatomic) UILabel *myLabel; -(IBAction)tapA:(id)sender; -(IBAction)tapB:(id)sender; @end
14.
ViewController.xib
要完成: (1)物件的連接 (2)事件與⽅方法的連接
15.
ViewController.m #import "ViewController.h" @implementation ViewController @synthesize
myLabel; -(IBAction)tapA:(id)sender 此處可改為 { myLabel.text = @"AAAA"; [myLabel setText:@"AAAA"]; } -(IBAction)tapB:(id)sender { [myLabel setText:@"BBB"]; } @end 思考問題:有需要使⽤用 property及synthesize嗎?
16.
Property, Synthesize • 類別
(class) • 屬性 (property) • ⽅方法 (method) • 物件 (實例,案例,Instance) • 物件內屬性值的設定與取得 (setter, getter)
17.
提昇寫程式的能⼒力 • 書上介紹了什麼語法,就⽤用什麼 • 線上查詢
UILabel 的參考⽂文件 • 網路上查詢更多的資源 • 善於利⽤用開發⼯工具提供的 "暗⽰示"
18.
練習 UILabel 的各種屬性
19.
由 xib 介⾯面上可以設定的屬性
20.
由『參考⼿手冊』上認識類別具有的屬性
在關鍵字下 按住 option 鍵及滑⿏鼠鍵
21.
UILabel Class Reference
(1/5)
22.
UILabel Class Reference
(2/5)
23.
UILabel Class Reference
(3/5) 基本屬性 ⼤大⼩小及調整 突出顯⽰示 影⼦子 ......
24.
UILabel Class Reference
(4/5) 可設定⽂文字內容和字型
25.
UILabel Class Reference
(5/5) 可設定⽂文字顏⾊色和......
26.
有寫跟沒寫差不多!
27.
靠直覺寫幾乎都不易成功
需要注意的是 『資料型態』或『類別』或『列舉項⺫⽬目』......
28.
可以由程式做的設定 •
text 改變⽂文字內容 • font ⽂文字字型 • color ⽂文字顏⾊色 • textAlignment 對⿑齊⽅方式 • enabled 有作⽤用或失效 • ................. • ⽂文字⼤大⼩小的調整 • ⾼高亮突出 (highlightedTextColor, highlighted) • 影⼦子 (shadowColor, shadowOffset)
29.
試試看...... 希望接下來出現的程式 是你⾃自⼰己打出來的
30.
⽂文字的基本屬性 - (void)viewDidLoad {
[super viewDidLoad]; myLabel.text = @"Hello"; myLabel.font = [UIFont fontWithName:@"Arial" size:80.0]; myLabel.textAlignment = UITextAlignmentCenter; myLabel.textColor = [UIColor yellowColor]; myLabel.textColor = [UIColor colorWithRed:1.0 green:1.0 blue:0.0 alpha:0.8]; myLabel.enabled = YES; }
31.
⽂文字的⾼高亮及影⼦子 - (IBAction) btnClick:(id)sender {
myLabel.highlightedTextColor = [UIColor redColor]; myLabel.highlighted = YES; myLabel.shadowColor = [UIColor greenColor]; myLabel.shadowOffset = CGSizeMake(5, 5); }
32.
網路上搜尋相關⽤用法
33.
想想⼀一些⽐比較像 APP 的變化 •
顯⽰示不同的⽂文字 ...... • 顯⽰示按了幾次按鍵 ...... • 顯⽰示丟骰⼦子的點數 ...... • 顯⽰示現在的時間 ...... • ............(發揮想像⼒力)............
34.
Project QV058 標籤物件 UILabel ⾃自由聯想練習
35.
ViewController.h #import <UIKit/UIKit.h> @interface ViewController
: UIViewController { IBOutlet UILabel *myLabel1; IBOutlet UILabel *myLabel2; IBOutlet UILabel *myLabel3; IBOutlet UILabel *myLabel4; IBOutlet UIImageView *ballImageView; int cnt; } - (IBAction) btn1Tap:(id)sender; - (IBAction) btn2Tap:(id)sender; - (IBAction) btn3Tap:(id)sender; - (IBAction) btn4Tap:(id)sender; @end
36.
ViewController.xib
37.
ViewController.m (1/4) - (IBAction)
btn1Tap:(id)sender { myLabel1.text = @"Hello World!!!"; }
38.
ViewController.m (2/4) - (IBAction)
btn2Tap:(id)sender { cnt++; myLabel2.text = [NSString stringWithFormat:@"你點了 %d 次", cnt]; } - (void)viewDidLoad { [super viewDidLoad]; cnt = 0; }
39.
ViewController.m (3/4) - (IBAction)
btn3Tap:(id)sender { int num = 1 + arc4random() % 6; myLabel3.text = [NSString stringWithFormat:@"骰⼦子扔出 %d 點", num]; NSString *imageString = [[NSString alloc] initWithFormat:@"Circle%d.png", num]; ballImageView.image = [UIImage imageNamed:imageString]; }
40.
ViewController.m (4/4) - (IBAction)
btn4Tap:(id)sender { // ⽅方法⼀一 NSDate *now = [[NSDate alloc] init]; NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init]; [dateFormat setDateFormat:@"yyyy-MM-dd HH:mm"]; NSString *nowString = [dateFormat stringFromDate:now]; 注意:不能同時存在 (因為⽤用相同的名稱) // ⽅方法⼆二 NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init]; [dateFormat setDateFormat:@"yyyy-MM-dd HH:mm"]; NSString *nowString = [dateFormat stringFromDate:[NSDate date]]; // 顯⽰示⽇日期 myLabel4.text = [NSString stringWithFormat:@"%@", nowString]; }
41.
隨機亂數 • 產⽣生範圍在 0
到 2^32-1 ( 4294967295) 之 間的整數亂數 • 無需設定亂數種⼦子 • 範圍為傳統 rand() 及 random() 的兩倍 • ⼀一般使⽤用 % (整數餘數) 取得所要的範圍
42.
隨機亂數使⽤用 •
取得 0~8 之間的整數亂數 int value = arc4random() % 9; • 取得 1~6 之間的整數亂數 int value = (arc4random() % 6) + 1; • 取得 0~100 之間的浮點數亂數 #define ARC4RANDOM_MAX 0x100000000 (double) value = floorf(((double)arc4random() / ARC4RANDOM_MAX) * 100.0f);
43.
範例:九九乘法 CAI (試著先不要看程式,聽過解說後,⾃自⼰己寫看看)
44.
Project QV057 九九乘法 CAI
⾃自助練習 標籤物件 UILabel 隨機亂數
45.
ViewController.h @interface ViewController :
UIViewController { IBOutlet UILabel *numLabel1, *numLabel2, *answerLabel; int num1, num2; } - (IBAction) ShowQuestion:(id)sender; - (IBAction) ShowAnswer:(id)sender; @end
46.
ViewController.xib
47.
ViewController.m (3/3) - (IBAction)
ShowQuestion:(id)sender { num1 = 1 + arc4random() % 9; num2 = 1 + arc4random() % 9; numLabel1.text = [NSString stringWithFormat:@"%d", num1]; numLabel2.text = [NSString stringWithFormat:@"%d", num2]; answerLabel.hidden = YES; } - (IBAction) ShowAnswer:(id)sender { int answer = num1 * num2; answerLabel.text = [NSString stringWithFormat:@"%d", answer]; answerLabel.hidden = NO; }
49.
- (IBAction) ShowQuestion:(id)sender {
*** 省略部份程式碼 *** answerLabel.hidden = YES; 增加畫⾯面上物件的 } 顯⽰示及隱藏 - (IBAction) ShowAnswer:(id)sender { *** 省略部份程式碼 *** answerLabel.hidden = NO; } - (void) initial { *** 省略部份程式碼 *** num1 = 3; num2 = 7; answerLabel.hidden = YES; } - (void)viewDidLoad { [super viewDidLoad]; ! [self initial]; }
50.
⾃自我挑戰 擴充成為四則運算,但是...... 加法為⼆二位數的加法 減法不得出現負數的答案
乘法 (略) 除法必須能夠整除 數字改⽤用圖⽚片顯⽰示 (注意答案的部份)
51.
延伸學習 • 查詢學過的 UI
元件 (UILabel, UIButton, UIImageView, UIAlert...) 還有哪些屬性或⽅方法可以使⽤用
52.
Apple 開發者網站
53.
developer.apple.com
54.
............