" Live as if you were to die tomorrow. Learn as if you were to live forever.. "
- Mahatma Gandhi

Creating a Dynamic Pie Chart on I-Phone

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 […]

Retina display issue with layer drawing in iOs

Posted on November 24th, 2015 by Waseem Ahmad

As most of us know 2x images are directly supported by iOs SDK for retina display, but it doesn’t support in case of layer. However, we have got this issue in one of the project where we are drawing image on a layer and images are showing blur.¬† The main reason behind this is that […]

Grid View in I-Phone using UITableView

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 […]

How to remove the issue when dealloc is not getting called.

Posted on November 24th, 2015 by Surbhi Garg

Have you ever come across a problem where dealloc of ViewController was not getting called? Yes, there can be a case where it can happen. I was adding a View as subview to another View like as follows [self.view addSubview:_secondViewController.view]; _secondViewController is an object of SecondViewController SecondViewController has a Valid NSTimer object. then i remove […]

Creating menu items at the right corner of system’s menu bar on Mac using Cocoa

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 […]

Does %@ represent NSString?

Posted on November 23rd, 2015 by Waseem Ahmad

Generally we think %@ represents NSString in objective c. Some people think %@ can be used in case of NSString only.   e.g. NSString* name = @”waseem”; NSLog(@”%@”, name);   Why? Actually %@ works for Id i.e object of class type NSObject. It means %@ can represent object NSArray, NSDictionary and so on. So we […]

Difference between @Class and #import in Objective C

Posted on November 23rd, 2015 by Surbhi Garg

  @Class- Is used when we only want to declare the object of any class.. For example: in .h file @class Mindfire; @interface MindfireSolutions :UIViewController { Mindfire* _mindfire; —- }     This is done because neither we want to use the methods of “Mindfire” Class at this time nor we want to set the […]

Padding Custom Margins In NSTextField

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. […]

Filtering colors from images and creating a new image from filtered color

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 […]

How to detect and identify mounted and unmounted USB device on Mac using Cocoa

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 […]

How To Customize Font For Text On A NSAlert View

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 […]

How To Notify Your Cocoa Application After Updating Specified Directory Path

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]]; […]

The anatomy of CFRelease in CoreFoundation and -release in Objective-C

Posted on November 23rd, 2015 by Mithlesh Jha

The anatomy of CFRelease(CFType type) and NSObject protocol’s -release message. CFRelease(), defined in CFBase releases a CFType instance. – release sends a release message to any of the NSObject derived class instance. In theory, both of these does the same job but applied to different types. We can define macros as shown,     #define […]