iOS Development is easy with XCode, Swift3, UITableView, cocatouch, let's build iPhone, iPad and Macbook Applications.

MASSIVE AVAudioPlayer Memory Leaks

I am using AVAudioPLayer to do the audio for my game. I have the following code in a method in a seperate class, which is called every time I want the ‘boing’ sound to play. Problem is, it leaks huge amounts of memory, to the point where the game becomes unplayable. Now i’m not releasing […]

Load PDF from documents directory – iPhone

Instead of loading a PDF from the resources folder I would like to load it from the documents directory. I have been trying to do this for days but the CGPDFDocumentRef keeps returning NULL. Here is my code: // Get Documents Directory NSArray *searchPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectoryPath = [searchPaths objectAtIndex:0]; NSString *tempPath […]

NSImageView is hoping when from the location when trying to rotate. How to stop it?

I am rotating an NSImageView from its center which is working perfectly however when I start the animation the NSImageView hops from its location to a random location. I do not know why is it happening. Please help. I am elaborating how I am doing it all. Also, I am providing a Github link so […]

How to retrieve the values for the particular key from CFMutableDictionary

In C++ EventType.find(1)->second can be used to find the value for the key 1. I am new to Objective C.I have implemented CFDictionary to addvalue onto it.But how do i retreive and view the values of the particular key. EDITED: CFNumberRef tId = CFNumberCreate(NULL,kCFNumberShortType,&st); CFDictionarySetValue(cfdict,tId,st); NSLog(@”The value is:%s”,(CFDictionaryGetValue(cfdict,tId))); Its running without error but i could […]

Getting Top 10 Highest Numbers From Array?

I am having a bit of a issue. I have an NSMutableDictionary with 10 NSMutableArrays in it. Each array has somewhere between 0-10 numbers which could each be any integer, e.g. 12 or 103. What I need to do is get the top 10 highest numbers from across each of the arrays. The trouble is, […]

ModalViewController loading on top of another Modal

There may be a better way to do this, and please direct me if there is. I’m creating an UIImagePickerController with an overlayView in viewDidAppear for ‘choose from library’, ‘take photo’, ‘flash’ ‘camera source’, etc. // Set up the camera imagePicker = [[UIImagePickerController alloc] imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera; imagePicker.delegate = self; imagePicker.cameraOverlayView = [self cameraOverlayView]; cameraOverlayView.backgroundColor […]

SplitViewController with TabbarController

I am using the split View functionality in my app.I have to put tabbar in rootViewController. But when I add controllers in tabbar and add them into split view it doesnt split. It only shows detailViewController. Here is the code in application did finish launching: – (void)applicationDidFinishLaunching:(UIApplication *)application { UIViewController *viewController2,*viewController3,*viewController4; rootViewController = [[[CategoryItemsList alloc] […]

Why is sysctl producing E_INVAL on Mac OS X?

Below is a pared-down (error/null checks omitted) snippet of C/Obj-C code that uses sysctl to get the argv of a particular process with PID 50. … int getProcessArgs[3] = { CTL_KERN, KERN_PROCARGS, 50 }; sysctl(getProcessArgs, 3, NULL, &length, NULL, 0); char* processArgs = malloc(length * sizeof(char)); sysctl(getProcessArgs, 3, processArgs, &length, NULL, 0); … The first […]

Replace <ol> & <li> tags from html code with number in iOS 6

I am getting html code from server & I want to display it in UITextView. I need to parse the html & show plain text in UITextView. I am using below code to parse html from this post Now I need to replace the li tag with the actual numbers . How can I do […]

why wont my UILabel display a NSInteger

I have a ViewController, and GameController class which is just subclassed from NSObject. The view controller has one button linked to it and fires a IBAction that inits a GameController class. In the init of the GameController class is a CADisplayLink that adds one to an int named score. In the debugger the score is […]