Posted on November 24th, 2015 by Hem Dutt
A pie chart is a circular chart divided into sectors. In a pie chart, the arc length of each sector is proportional to the quantity it represents. It is used to showcase different percentages of an entity distributed with time or any other parameter. For example it can be used to show Profit of a […]
Posted on November 24th, 2015 by Hem Dutt
While reading a tip about creating a Grid View in I-Phone through customization of Scroll View, a question popped up in my mind. Is there an alternative way of doing that with less customization? Sure enough, after some research I found that, yes, Grid View can be made using TableView. In fact even multiple Grid […]
Posted on November 23rd, 2015 by Hem Dutt
Everyone must have noticed some menu items at the right corner of the system’s menu bar while working on Mac. These are called “Menu Bar Extras”. These extra menus are typically used to display application’s or system’s status information. Some of the built-in menu extras are time indicator, system’s volume control etc. Although these menu […]
Posted on November 23rd, 2015 by Hem Dutt
Suppose we need to add padding to a text field or in a Table row (which is generally a NSTextField cell). This is possible but there in no direct method for this in Cocoa. The padding can be added by subclassing NSTextFieldCell and by doing customization as explained. Create a Class say CustomTextFieldCell inheriting NSTextFieldCell. […]
Posted on November 23rd, 2015 by Hem Dutt
Sometimes in multiple user scenario having different authorizations ,in the app we may need to provide users with different menu item depending on their permission set in the app. Suppose we need to add a sub menu item having title ‘title’ under File Menu of the application. Then following code can be implemented. NSMenuItem* newItem […]
Posted on November 23rd, 2015 by Hem Dutt
There could be a scenario in which a application would need to know whether the user is Admin or not, before or after startup to allow/block user from using it’s certain functionalities. To achieve this kind of “Authorization” we need to ask user about his account password and check it against his username. To do […]
Posted on November 23rd, 2015 by Hem Dutt
Suppose we need to show the effect of only the red component of it’s color on the image, Then this can be done by reading all the pixels of that image and extracting and applying only the red color on all pixels. The other color components i.e blue and green will be filtered out and […]
Posted on November 23rd, 2015 by Hem Dutt
There could be a situation in which we have to notify the application about mounting and un-mounting the USB and also to identify the USB i.e on which path it is mounted, what is the type of USB e.g I-Pod, I-Phone , Pen Drive etc. 1. To get the notification for mounting and un-mounting of […]
Posted on November 23rd, 2015 by Hem Dutt
When we create and run an NSAlert, by default it has a Message text (set to Alert by default) and an informative text (set to nil by default). Suppose one needs to customize the fonts for these texts, then how can one do this? There is no direct API as such for this in NSAlert […]
Posted on November 23rd, 2015 by Yogesh Arora
NSMetadataQueryDidUpdateNotification can be used to notify your Cocoa application if you do any updation at specified directory path but first you have to prepare NSMetadataQuery and then add observer to NSNotificationCenter for NSMetadataQuery object. – (void) setupQueryNotification { NSString* dirPath = @”/Library/Application Support/tempFolder”; //Path to folder NSMetadataQuery* query = [[NSMetadataQuery alloc] init]; [query setSearchScopes:[NSArray arrayWithObject:dirPath]]; […]
Posted on November 23rd, 2015 by Akram Ahmad
We can blend two images on mac easily by following these steps. 1. First, make sure that dimension of both images should be equal. if they are not then you should scale source image in order to equalize them. 2. Get the opacity of source image. 3. Calculate the opacity of target image simply by […]