日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

IOS--设计更丰富的界面

發布時間:2025/3/21 编程问答 20 豆豆
生活随笔 收集整理的這篇文章主要介紹了 IOS--设计更丰富的界面 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

?

???

---完成輸入后關閉鍵盤 在ViewController.h文件中聲明,放在屬性的下方 - (IBAction)textFiledDoneEditing:(id)sender;切換到ViewController.m,添加代碼- (IBAction)textFiledDoneEditing:(id)sender{[sender resignFirstResponder]; }----通過觸摸背景關閉鍵盤, 添加一個按鈕,讓他填充整個屏幕, 用戶觸到這個按鈕就觸發操作,將nameFiled和numberFiled設置成第一響應狀態 ViewController.h中添加— (IBAction)backgroundClick:(id)sender;在實現文件中添加:- (IBAction)backgroundClick:(id)sender{[nameFiled resignFirstResponder];[numberFiled resignFirstResponder]; }---實現滑塊和標簽,標簽顯示滑塊的值 在.h 文件中聲明一個輸出口和一個操作 IBOutlet UILabel *sliderLable;@property (nonatomic, retain) UILable *sliderLable- (IBAction)sliderChanged:(id)sender;切換到.m文件,添加屬性同步 實現sliderChanged:方法@synthesize sliderLable;- (IBAction)sliderChanged:(id)sender {UISlider *slider = (UISlider *)sender;int progressAsInt = (int)(slider.value + 0.5f);NSString *newText = [[NSString alloc] initWithFormat:@"%d", progressAsInt];sliderLable.text = newText;[newText release]; }----隱藏和顯示多個控件的最簡單的方法是, 使用UIView作為需要隱藏或顯示的項的公共父項.除了為兩個開關創建輸出口外,我們還需要為父視圖創建輸出口IBOutlet UISwitch *leftSwitch; IBOutlet UISwitch *rightswitch; IBOutlet UIView *switchView;@property (nonatomic, retain) UISwitch *leftSwitch; @property (nonatomic, retain) UISwitch *rightSwitch; @property (nonatomic, retain) UIView *switchView;-(IBAction)switchChanged:(id)sender; -(IBAction)toggleShowHide:(id)sender;在實現文件中添加如下代碼 @synthesize leftSwitch; @synthesize rightSwitch; @synthesize switchView;-(IBAction)switchChanged:(id)sender {UISwitch *whichSwich = (UISwitch)sender;BOOL setting = whichSwitch.isOn;[leftSwitch setOn:setting animated:YES];[rightSwitch setOn:setting animated:YES]; }-(IBAction)toggleShowHide:(id)sender {UISegmentedControl *segmentedControl = (UISegmentedControl *)sender;NSInteger segment = segmentedControl.selectedSegmentIndex;if(segment == 0) [switchView setHidden:ON];else [switchView seHidden:YES]; }

  

?

轉載于:https://www.cnblogs.com/ShlodenZhang/archive/2013/06/06/3120848.html

總結

以上是生活随笔為你收集整理的IOS--设计更丰富的界面的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。