objective-c

Can't set a custom backgroundColor with an if-query in applicationDidFinishLaunching

Hello, my program normally has a standard background: "black.jpg". In the applicationDidFinishLaunching I did the following: [window addSubview:viewController.view]; [window makeKeyAndVisible]; viewController.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"black.jpg"]]; and I have a nice black back...

Autoscroll a UITableView

I have implemented a UITableView, which shows up fine as a subview in my iPhoneApp. Now this is supposed to be something similar to a tele prompter, so I would like to autoscroll this thing up, till the last cell is there. I was playing around with -scrollToRowVisible, but this did not seem to work. Can anyone give me a hint here or poi...

Math Libraries for iPhone

Not wanting to re-invent the wheel, are there any open-source (or included) math libraries in Objective-C (for iPhone) that can calculate Internal Rate of Return (IRR) or Modified Internal Rate of Return (MIRR)? I'd hate to have to re-do all that work if someone out there has already done it. Thanks! ...

Objective c isKindOfClass missunderstanding?

I have following structure of objects: Animal, Dog and Cat. As You expect Dog and Cat are inherited from Animal. And I've a farm class: @implementation AnimalFarm -(Animal*) createAnimal:(AnimalType)type{ switch (type) { case CAT: return [Cat new]; case DOG: return [Dog new]; default: return [Anim...

Trying to NSLog an NSNumber ivar in an instance method

Hello, I'm working on a console app that is tracks different songs. I'm working on getting the song class up off the ground first and have run into a snag trying to log an nsnumber which has been allocated for the song duration into an nslog statement: // // Song.h // MusicCollection.15.9 // // Created by Nicholas Iannone on 1/11...

Memoization in static Objective-C class

Say I have a class method like + (double)function:(id)param1 :(id)param2 { // I want to memoize this like... static NSMutableDictionary* cache = nil; // // test if (param1,param2) is in cache and return cached value, etc. etc // } Thanks!! ...

How do I compare 2 integers without getting warnings?

Hello I have a variable Player1Visits which is declared as int If I try to compare this to 1 using Player1Visits == 1 I get the warning comparison between integer and pointer. Should I be using a different type? Paul ...

UITableView Problem with Sections

Hi, I have all the code written out to divide an NSMutableArray into sections for a UITableView. But in cellForRowAtIndexPath I am finding that indexPath.row returns only the row for the current section. Is there any way to simply provide the number of the row for the entire UITableView. If anyone needs to see the code I will attach it b...

Why are (UDP multicast) packets not being recieved?

So, I've been trying to figure out exactly why this isn't working but I haven't a clue. I've managed to send packets from the iPhone and receive them on my Mac. And according to tcpdump my mac is correctly sending the packets. Additionally, if I run this in the simulator it works fine. This leads me to believe that it's a network problem...

Initialising a static variable in Objective-C category

I was trying to create a static variable to store a dictionary of images. Unfortunately, the best way I could find to initialise it was to check in each function that used the variable. Since I am creating this variable inside a category, I can't just initialise it inside the initialiser. Is there a neater way of initialising navigationB...

How to set up loading page in iPhone game.

Hi everyone. I have some trouble with my game (using Cocos2D). I have an introduction, then it will go to the game afterward. The thing here is, on the simulator, it always appears at real-time when it switches scene Intro to GamePlay. But in the actual phone, I know it would be slower and take more time to switch. But before the player...

Making good use of XCode performace tools

What are the best practices, tricks, and tutorials for using XCode's performance tools, such as the Leak Monitor and the CPU sampler, for someone trying to debug and enhance performance of an iPhone application? Thanks! ...

How to add (id) sender to the following -(IBAction)?

How do you add a (id) sender to the following code? - (IBAction) gobutton: (UIButton *) button5 { Everything I try fails, any help would be appreciated. Thanks. EDIT: I need to keep the (UIButton *) button 5 reference in the (IBAction) ...

How to add "more" button to Tab Bar?

My iPhone app has a tab bar controller at the bottom of the view - and at the moment I have three buttons on it. However, I want to add more, but to do so I need to turn the last of the three buttons into a "More..." button, because otherwise the text on the other buttons runs into each other. I know that if you have over 5 buttons in t...

Objective C General Print

Does objective C have a general print command like Python? NSLog seems to log it rather than print out to console. printf only accepts specific types. ...

Getting the data from a NSTableView to a NSViewController

I'd like to have a 'Detail view' for when the user double clicks on a row, I'm just not sure how to get the data to the NSViewController, so it can display the content. I'm using CoreData and I can't think of a way to do this. ...

Objective C /iPhone : Is it possible to re initialize an NSArray?

I read that non mutable data types can't be modified once created.(eg NSString or NSArray). But can they be re-initialized to point to a different set of objects? If so, do I use release to free any alloc from first time round in between uses? eg: myArray declared as NSArray *myArray in interface, and as nonatomic/retain property.myA...

How to show multiple customcell and a custom section header in one uitableview?

I want to create a tableview like this. All sections have custom section header views. The first row of first section contains a custom row rest of the first section cell's are another custom cell. Though every section will contain different type of cells. So what is the best approach to achieve this while managing the speed of tablev...

user location Blue marble drop

Does anyone know what triggers the blue marble animation. I know that it happens when the location gets updated but how do i trigger that event with whatever is in that property. I have an app that i would like to show the user's location when the map appears, but then clear the map of all annotations (including the user location)when th...

how to check an nsmutablearray is null or not

How to check an NSMutableArray is null or not ? ...