Blog Archives

Undo/Redo in a Cocoa Application (Example to Undo/Redo addition & deletion of rows in a table view)

Undo/Redo functionality in a Cocoa application – NSUndoManager

This article will give you an overview of adding undo and redo functionality to a cocoa application by an example that undo/redo addition and deletion of rows in a TableView.

Lets start with How Undo Manager works?
As per Apple’s Reference Guide “You register an undo operation by specifying the object that’s changing (or the owner of that object), along with a method to invoke to revert its state, and the arguments for that method. When performing undo an NSUndoManager saves the operations reverted so that you can redo the undos.” Read the rest of this entry

Advertisements

Circular Progress Bar

Circular progress indicator We  all are familiar with native progress bar but a circular progress bar might be required in a project. In circular progress bar, progress of process will be shown by a bar filling in clockwise or anti-clockwise direction. Here I am providing the code to create a circular progress bar as shown in the image below: Read the rest of this entry

Round Cornered Views

Custom NSView with rounded corner:

To draw a custom view with its one or more corners round, all you need to do is draw a bezier path of the required shape in the view’s drawRect: method.
Also, this can be used to customize any NSView subclassed objects as  NSTextView, NSTextField etc.
Here I present the code to create a text field with any one round corner as shown in the image below. The code can be easily changed to create more than one round corners of a view. Read the rest of this entry

%d bloggers like this: