Operating system requirements: iOS 5.0 or later.
Mobile device: iPad.
This example describes creating a note in regular report and its displaying in edit dialog.
Executing the example requires to place the following code in the body of the executeExample method of the ViewController class (see the Displaying of Regular Report section):
MAProceduralReportDataViewController<MADataViewControllerProtocol> *contr = (MAProceduralReportDataViewController<MADataViewControllerProtocol> *)[(MAProceduralReportViewController *)m_controller activeDataViewController]; // Create a new note Note *note = [Note new]; [note initWithText:@"New" offset:CGPointMake(10, 20)]; [note setText:[NSString stringWithFormat:@"%@ note", [note text]]]; [note setOffset: CGPointMake([note offset].x * 10, [note offset].y * 10)]; [note setPage:[contr pagesCount] - 1]; // Specify the time 12:33:05 as current NSDateComponents *comps = [NSDateComponents new]; [comps setHour:12]; [comps setMinute:33]; [comps setSecond:5]; NSCalendar *gregorian = [NSCalendar currentCalendar]; NSDate *date = [gregorian dateFromComponents:comps]; // Set time of last note change [note setTimestamp:[date timeIntervalSince1970]]; // Determine a dialog for creating and editing of note AddNoteDialog *noteDialog = [[AddNoteDialog alloc] init]; [noteDialog setDelegate:contr]; // Delegate [noteDialog setPoint:[note offset]]; // Note location [noteDialog setTimestamp:[note timestamp]]; // Note creation time [noteDialog setText:[note text]]; // Note text [noteDialog setMode: kNoteDialogNewNote]; // Edit note [noteDialog setNoteIndex:1]; // Note index in array of all notes // Refresh dialog [noteDialog refresh]; // Set contents size in popup window [noteDialog setContentSizeForViewInPopover:CGSizeMake(300.0, 200.0)]; // Create a popup window UINavigationController *navController = [[[UINavigationController alloc] initWithRootViewController:noteDialog] autorelease]; UIPopoverController *popoverController = [[UIPopoverController alloc] initWithContentViewController:navController]; popoverController.delegate = contr; // Change current page of regular report [contr jumpToPage:[note page]]; // Determine popup window contents CGPoint offset; // Determine popup window margins offset.x = note.offset.x * [contr pdfView].scrollView.zoomScale; float pageOffset = [note page]*[contr pdfView].scrollView.contentSize.height / [contr pagesCount]; offset.y = (note.offset.y + pageOffset)* [contr pdfView].scrollView.zoomScale; // Display popup window [popoverController presentPopoverFromRect:CGRectMake(offset.x, offset.y, 1, 1) inView:[contr pdfView].scrollView permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
After executing the example the last page of regular report has a note created and displayed. The note is located in the point with the coordinates (100, 200), its change time is 12:33:05, and it contains the text "New note":
Then reset note text and last change time by adding the following code string to the example:
[noteDialog reset];
After executing the example the note edit dialog does not contain text, and the note last change time is replaced with the current one:
See also: