objective-c

ObC : app crashes after returning NSMutableArray ??

Hi, I am new to ObC and have a problem that i just cant fix. There may be other issues as well but the main issue is this: Starting the app Press button = load new view In the new viewDidLoad i call another object/function and send a NSMutableArray Process data and send back a NSMutableArray App crash, see comment where. Most often wh...

How to run minted package in TeXnicCenter using MiKTeX ...

I am working with LaTeX on Vista using TeXnicCenter 2.0 Alpha 3 (build 1118) having installed MiKTeX 2.8. I want to use code highlighting for Objective-C and read here that the minted package is great. I installed Python 2.7 and pygmentize as told in the minted documentation. I also set the compiler option -shell-escape in TeXnicCenter. ...

iPhone App - background disappears after memory warning

Hello all When I receive a memory warning in my navigation based iPhone App the background image disappears in the previously allocated navigation controllers. The background image is set as the background property of a UIView. This view is then added to the main window of the App delegate: UIView *backgroundView = [[UIView alloc] ini...

Custom UINavigationbar for different views - iPhone SDK

Hi all, I have implemented a custom UINavigationbar using this code (placed in the top of my AppDelegate.m file): @implementation UINavigationBar (CustomImage) - (void)drawRect:(CGRect)rect { UIImage *image = [UIImage imageNamed: @"NavigationBar.png"]; [image drawInRect:CGRectMake(0, 0, self.frame.size.width, self.frame.size.he...

Newbie IPhone developer using Instruments panel: Where is my leak?

Update I have update the planets.m/h files to reflect the suggestions made by the commentors (thank you bbum and DarkDust. my factory methods now all call autorelease and look like this: - (Planet *) initWithName: (NSString *)name; + (Planet *) planetWithNameAndMoons:(NSString *)name moons:(id)firstObj, ... NS_REQUIRES_NIL_TERMINATI...

iPhone: transfer objects between NSManagedObjectContext objects?

I currently have an NSManagedObjectContext containing 5 Video Objects displayed in a table view. When a user selects a row, I'm going to push in a new view controller to display object details, and give the user the option to 'add Video to favorites'. To do this, I want to create a new NSManagedObjectContext, assign the selected Video ...

ObjC memory debugging help

Part of my app downloads images from the Internet and stores them in a mutable array. This is so that they do not have to be downloaded every time the user wants to view them. When I exit the view that deals with these images, the mutable array gets released. If there is only one image stored in the array, everything runs smoothly. Howev...

How to programmatically detect Game Center?

I'm adding Game Center support to my game. Because my game can run on iOS versions back to 3.0, I want to have it fallback to just saving achievements and leaderboards locally in the absence of Game Center. Right now, I have this: + (BOOL) isGameCenterAvailable { Class playerClass = NSClassFromString( @"GKLocalPlayer" ); if( playerC...

Is possible make a .xcodeproj file and how?

Hello everyone, is possible make a .xcodeproj file and how? I'd like to make a Mac software which have to build a .xcodeproj file. ...

Set delegate in a different class

I'm trying to write my first iPhone app and i'm having some trouble with a delegate. I have a class that utilises the AVAudioPlayer to play some sound, I then have another class that I need to do something when that sound is complete. So I need this class to implement audioPlayerDidFinishPlaying method of the audio player. The problem...

Problem with hash256 in Objective C

Hi,when i use this code for generate an hash256 in my iPhone app: unsigned char hashedChars[32]; NSString *inputString; inputString = [NSString stringWithFormat:@"hello"]; CC_SHA256([inputString UTF8String], [inputString lengthOfBytesUsingEncoding:NSASCIIStringEncoding ], hashedChars); NSData * hashedData = [NSData...

"_OBJC_METACLASS_$_NSObject", referenced from: Delagates and classes??

hello i keep getting this error on 1 custom frameworks i just added i tried adding "-ObjC -all_load" in other linking flags (main project) also when i enable the search paths directory on the target info i get one error that says this Argument list too long: recursive header expansion failed at /Applications/eclipse/plugins/com.google....

Catching drag events on a view.

I can get button presses etc in Iphone. Is there away to catch drag events? Or do i need to make something custom to handle this? Are there any complications if you have a mainview and inside the main view you have 2 subviews. So basically 3 view on the sceen at once. Can all drag events go to the mainview? Many Thanks, Code ...

How to change NSURL file name.

Maybe this is a noob question, i have an NSURL from savePanel, and i want to save the file with such an identifier name. How to change the filename on NSURL? here's my save method : for (int i=0; i<[rectCropArray count]; i++) { //the code goes on.. CGImageDestinationRef dest = CGImageDestinationCreateWithURL(url, outputTyp...

Questions about inline

Hey guys, I had some questions about using inline. I have been told to use it on small functions that I use a lot but I want to understand exactly how it works. Here is just a snippet of how I use it. static inline point3D createPoint3D(GLfloat x, GLfloat y, GLfloat z){ point3D newPosition; newPosition.x = x; newPosition.y = y;...

Difference between 2.0 and 2.0f

Hey guys, I had some questions about putting f next to literal values. I know it defines it as a float but do I really need it? Is this 2.0f * 2.0f any faster then 2.0 * 2.0? and if I have a variable like float a = 2.0; is this 2.0f * a any faster then 2.0 * a? ...

Return multiple objects from a method in Objective-C

I have a method that takes an NSMutableArray as a parameter, and I would like it to return that array, another array that is created in the method, and an int created by the method. I realize this could be done by making an array that had all these objects in it, and returning that, then removing them from the array outside the method, ...

Thread causes crash when exiting a view - result of code change to prevent UIActivityIndicatorView not displaying, UIImageView not hiding.

When an image is loading, I want to hide the old image and display an activity indicator. The following code should (IMO) work, however, the image does not hide and no activity indicator is displayed. If the image has not been downloaded previously, there is a discernable wait whilst it does download. What am I doing wrong? - (UIImage *...

Possible to use UIActionSheet from Application Delegate?

I have a common UIActionSheet which I use across about 10 different view/view controllers. I'm wondering if it's possible to use UIActionSheet from the app delegate in order to prevent code duplication? So far my attempts to use an action sheet from the delegate haven't worked, I suspect my problem lies when calling the showInView metho...

How can I display a simple animated spectrogram to visualize audio from a MixerHostAudio object?

Hi all, I'm working off of some of Apple's sample code for mixing audio (http://developer.apple.com/library/ios/#samplecode/MixerHost/Introduction/Intro.html) and I'd like to display an animated spectrogram (think itunes spectrogram in the top center that replaces the song title with moving bars). It would need to somehow get data from t...