2013年8月19日月曜日
iOS - 函數定義
- (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component{
return [pickerData count];
}
函数类型 (函数返回类型) 函数名1:(参数类型)参数1 函数名2:(参数类型)参数2 {
函数实现
}
-(函数返回类型) 参数名:(参数类型)参数1 参数名2:(参数类型)参数2 {
函数实现
}
这个函数的函数名是 pickerView:numberOfRowsInComponent: 函数名被参数拆成了2个部分,你可以理解为每一个部分都是对紧接着的那个参数的一个附加的说明。
比如这个函数名里面numberOfRowsInComponent: 这部分就解释了(NSInteger)component这个参数的作用。
可以看看这个帖子:
http://stackoverflow.com/questions/683211/method-syntax-in-objective-c
或者Objective-C的函数语法说明:
http://developer.apple.com/library/ios/#referencelibrary/GettingStarted/Learning_Objective-C_A_Primer/_index.html
iOS - Hello World
iOS - Hello World
建立個專案
選擇 single view (自動記憶體管理記得打勾)
拉進個 UILabel, UIButton
UILabel 是用作顯示文字用
UIButton 是用作互動回饋用
目標:UILabel 上面文字本來是 “ Show Your Message ! ”
當我們按下Button的時候,UILabel 上面的文字會變成
“ Hello World !! ”
滑鼠對 UILabel 拖移到 ViewControll.h , connection 選擇 outlet ,命名為 lblDisplayMsg
同樣對 UIButton 右鍵拖到 ViewControll.h , connection 選擇 outlet ,命名為 btnOK
接著命名方法
對 UIButton 右鍵拖到 ViewControll.h , connection 選擇 action ,命名為 btnOK_Click
名稱宣告完畢了
接著要實作方法 btnOK_Click
打開 ViewControll.m ,可以從最下面看到
- (IBAction)btnOK_Click:(id)sender {
}
在裡面塞入Your are shock,歐不,是 Hello World
變成下面這樣
- (IBAction)btnOK_Click:(id)sender {
self.lblMsg.text = @"You are shock!";
}
請注意一定要打 self
請注意一定要打 self
沒有打什麼都沒有哈哈
建立個專案
選擇 single view (自動記憶體管理記得打勾)
拉進個 UILabel, UIButton
UILabel 是用作顯示文字用
UIButton 是用作互動回饋用
目標:UILabel 上面文字本來是 “ Show Your Message ! ”
當我們按下Button的時候,UILabel 上面的文字會變成
“ Hello World !! ”
滑鼠對 UILabel 拖移到 ViewControll.h , connection 選擇 outlet ,命名為 lblDisplayMsg
同樣對 UIButton 右鍵拖到 ViewControll.h , connection 選擇 outlet ,命名為 btnOK
接著命名方法
對 UIButton 右鍵拖到 ViewControll.h , connection 選擇 action ,命名為 btnOK_Click
名稱宣告完畢了
接著要實作方法 btnOK_Click
打開 ViewControll.m ,可以從最下面看到
- (IBAction)btnOK_Click:(id)sender {
}
在裡面塞入Your are shock,歐不,是 Hello World
變成下面這樣
- (IBAction)btnOK_Click:(id)sender {
self.lblMsg.text = @"You are shock!";
}
請注意一定要打 self
請注意一定要打 self
沒有打什麼都沒有哈哈
2013年8月13日火曜日
2013年8月12日月曜日
iOS - check the internet connection in iOS SDK
Check for internet connection - iOS SDK
http://stackoverflow.com/questions/13735611/check-for-internet-connection-ios-sdk
http://developer.apple.com/library/ios/samplecode/Reachability/Introduction/Intro.html
http://stackoverflow.com/questions/13735611/check-for-internet-connection-ios-sdk
http://developer.apple.com/library/ios/samplecode/Reachability/Introduction/Intro.html
2013年8月8日木曜日
2013年8月6日火曜日
C# - DataGridView
資料在 dataGridView 上面顯示出來後,控制焦點在第二行上面
dataGridView1.focus();//先將焦點放在 dataGridView上面
dataGridView1.CurrentCell = dataGridView1[p1, p2]; //指定目標cell
登録:
投稿 (Atom)
