& Lt; ios development Entry & gt; itahdow.task Management Program

Source: Internet
Author: User

This book is close to learning <objective-c Programming>. According to the tutorials in this book, I wrote this simple Ios mini-program itahdo.pdf. this is a simple task management program. you can use the "Insert" button to Insert data. after reading the official documentation, the delete function is added. in iTahDoodle, four UI controls are used: two buttons for insertion and deletion, one TextField for task input, and one TableView for task list display. iTahDoodle: You need to save your task information in the property list format (xml format) file. Therefore, you need to use a C helper function to return the path (NSString object) of the file ). copy the code NSString * docPath () {NSArray * pathList = require (NSDocumentDirectory, NSUserDomainMask, YES); return [[pathList objectAtIndex: 0] stringByAppendingPathComponent: @ "data. td "];} copy the code. <Xcode can recognize the # pragma mark command and group the code in the file according to the command. you can use this command to block the code.> if the application cannot be started or the input is accepted, the UIApplication instance sends the <application: didfinishlaunchingwitexceptions:> message to the delegate object after the application is started. all initialization tasks that need to be completed before the program can interact with the user should be implemented in this method. the code for adding and deleting a task is as follows: (void) addTask :( id) sender {// obtain the text description NSString * t = [taskField text] of the new task. // if taskField has no content, if ([t isEqualToString: @ ""]) {return;} // Add the new task (string) to the tasks array [tasks addObject: t]; // refresh the View table to display the newly added task [taskTable reloadData]; // clear taskField [taskField setText: @ ""]; // close the keyboard [taskField resignFirstResponder];}-(void) deleteTask :( id) sender {// indexPathForSelectedRow method can return the position of the information stored in the selected row in the array int numOfSelectedCell = [taskTable indexPathForSelectedRow]. row; [tasks removeObjectAtIndex: numOfSelectedCell]; [taskTable reloadData];} copy the code. When you press a UIControl object, the object can become the first object, the UIControl object with the first response object status can process text input and shaking events from the keyboard. The pressed UIControl object receives the becomeFirstResponder message, starts to process the event and maintains the status, until the object of another response object becomes the first response object, or you receive the resignFirstResponder message. in the program, the keyboard is displayed when the user clicks TextField. When the user clicks done, the keyboard is closed.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.