ReadMe.txt
NineSlice |
This application demonstrates use of the 'nine-slice' functionality of the CALayer Class. Also demonstrates the use of drag-n-drop to load images. |
NineSliceAppDelegate.h/m |
Standard app delegate generated by Xcode for a new project. |
AppController.h/m |
This is the main controller for the application and handles the setup of the layer hierarchy, connecting them up to the view, handling drag-n-drop, and updating the layers when the sliders move. An instance of this class resides in MainMenu.xib. That instance is the delegate of the application's main window (to facilitate drag-n-drop), and uses IBOutlet references for the views (which have been wired up through Interface Builder). |
-(void)awakeFromNib |
This method will be called when the AppController instance is 'defrosted' from the nib and will setup the layer hierarchy, register for drag-n-drop notifications, and load the placeholder image. |
-(IBAction)slidersMoved:(id)sender; |
Update the layer with the new slider values. |
-(IBAction)resetSliders:(id)sender; |
Reset the slider values and update the layer. |
-(NSDragOperation)draggingEntered:(id < NSDraggingInfo >)sender |
Inform the pasteboard that we intend to link to the dragged file, used to implement the 'drag-n-drop' feature. |
-(BOOL)performDragOperation:(id < NSDraggingInfo >)sender |
If the dragged file is a valid image, update the views. Otherwise reject, used to implement the 'drag-n-drop' feature. |
SliceView.h/m |
View to display the guidelines which show how the image will be sliced. |
-(void)drawRect:(NSRect)rect |
Called by the system to redraw the window, draws the image and slice guidelines according to the values 'southWest' and 'northEast'. |
-(void)sliceWithRect:(CGRect)rect |
Given new dimensions for the center rect, redraw the guidelines. |
Copyright © 2011 Apple Inc. All Rights Reserved. Terms of Use | Privacy Policy | Updated: 2011-04-15