IOS學習之-私人通訊錄

來源:互聯網
上載者:User

標籤:

通過一段時間IOS的學習完成了一個簡單的應用,"私人通訊錄"。

運行效果如:

1、登入頁

2、通訊錄列表

3、添加

4、編輯

5、刪除

6、登出

總視圖結構如:

總結本程式是知識點

1、使用了NSNavigation Controller進行管理每一個Controller。

2、使用NSKeyedArchiver進行緩衝通訊錄資料

3、Controller之間如何進行傳送資料

    傳送資料分為順傳和逆傳資料。

    順傳時可以實現NSNavigation 的代理方法prepareForSegue中擷取目標controller,給

目標Controller添加資料屬性進行賦值即可。

    逆傳時可以通過給目標controller進行添加代理方法,源controller進行實現代理方法來進行

擷取目標controller傳入的資料。源controller得到資料後進行處理。

   另:注意順傳資料時給目標controller中的控制項進行賦值必需等到載入完成再賦值”viewDidAppear“方法。

4、IOS通知進行監聽textfeild的change事件,存在值可以進行登入、添加和儲存按鈕操作。

 [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(txtChange) name:UITextFieldTextDidChangeNotification object:self.name];    [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(txtChange) name:UITextFieldTextDidChangeNotification object:self.phone];

    註:當前的controller添加通知監聽後,在controller銷毀時要進行取消通知。

-(void)dealloc{    [[NSNotificationCenter defaultCenter]removeObserver:self];}

 

IOS學習之-私人通訊錄

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.