objective-c

super simple program is not working

I'm working on the book "programming in objective c 2.0" and im not understanding why this program is not working. basically i need to build a program to convert a fahrenheit value to a celcius one. I figured to just solve it very simply without objects and just use a straight procedural methodology, any way the problem I'm having is th...

Getting the main window of an app via an NSRunningApplication instance

Hello all, I'm observing NSWorkspaceDidDeactivateApplicationNotification notification to get the application that has just lost focus. I'm ending up with an instance of NSRunningApplication which you get from the userInfo dictionary key - NSWorkspaceApplicationKey - of the notification object. I was thinking that I'd be able to get the...

best way to release an object that you lose track of

So I am creating an class that does an animation. There is a timer delay. So I will instantiate this class. Have it do its thing then have a timerFinished type of delegate to continue on. This question comes from my sheltered garbage collection career. What is the best way to release this object? Do I have it release itself when it...

AlertView with TextField Problem.

Hey guys, I'm having trouble obtaining the value/text from a AlertView TextField. Maybe someone can look at my code and see what I'm doing wrong. Every time I press OK, the label get's a (null) value. I must be missing something here. TextFieldINAlertViewController.h #import <UIKit/UIKit.h> @interface TextFieldInAlertViewControlle...

iPhone client with a python socket

Hi all, i am creating a python server socket that sends data to the client reguarding files status... what i have is a list containing dictionaries: [{'Status': '[2,5%]', 'File': 'SlackwareDVD.iso'}, {'Status': '[21,8%]', 'File': 'Ubuntu_x86.iso'}] the socket, when asked, sends this data, obviously it is sent as a string type.. i was...

@Synthesize array of class objects?

Having some difficulty with what I thought would be straight forward. I am trying to make an array of class objects but running into different problems. The goal was to create one class that held an array of another class of objects. Any help appreciated: // Basic class unit @interface MobRec : NSObject { NSString *MName; int...

delegates and multiple methods

I have a problem that I solved using delegates, but now I am thinking I may have made a mistake. This is what I want to do. I have a class that runs on a delay. When it is done it has a finished delegate that it calls. Now I have the main class that creates two of these delay classes. I don't want them to both be handled by the sa...

Proper Object Oriented application set up

I am trying to learn my first programming language. Unfortunately I picked the Iphone to start. Thought it would be easy... ooops. Anyway 4 weeks later I've actually got a couple of working apps! kind of... One of my apps that had a couple of text boxes and a couple of labels. Each person has a has button that starts a timer that decre...

Objective C one class not seeing the other

I have these two classes MobRec & MobDef and I want to reference an array pointer of (MobDef) *mobInfo from MobRec. #import the mobdefs.h file in MobRec.h or .m but no luck any ideas? MobRec.h // Basic class unit @interface MobRec : NSObject { NSString *mName; int speed; } @end MobDef.h // Master Class holding an array of units...

Setting a new contentSize to a UIScrollView causes it to scroll back to point x:0 y:0

In my app I have some logic that changes the UIScrollView's contentSize dynamically. The problem I'm running into is that when I change the contentSize it sets the contentOffset to CGPointZero or something like that. I guess you can't set contentSize to be in the middle of the UIScrollView. Any ideas on how to get this to work? In othe...

Custom Class - IBOutlets Not Working?

This is probably a very easy question to answer, but for the life of me I can't seem to get this to work. I'm developing for Mac OS X with Objective-C, and I create a custom class (AppController.h and .m). I hand-wrote two IBOutlets (NSTextField, NSImageView), made sure to do the "@property" line in the .h and the "@synthesize" in the ....

iphone OCMockObject and unit-testing a class that inherits from NSURLConnection

I want to unit test the custom init method of a class that inherits from NSURLConnection -- how would I do this if the init of my testable class invokes NSURLConnection's initWithRequest? I'm using OCMock and normally, I can mock objects that are contained within my test class. For this inheritance scenario, what's the best approach to ...

NSMutableDictionary key values

is it true that the key values for NSMutableDictionary can only be strings? I was trying to use objects, but I am getting a warning. ...

How to Handle an Indefinite Amount of TableViews in an iPhone drill-down app

I've Created a UITableViewController subclass. Do I only need one controller? Do I just instantiate multiple instances of that one subclass? The iPhone App I'm building will start with a Table of a list of people. If the user taps a person, a new table will be pushed in with a list of Companies they've worked for. If the user then ta...

objective c Class code not executing? what is my problem?

Having some issues with code not executing within the classes I created and thought I initialized and implemented correctly here are all the files. There is a class with an array of another class. Then implemented in the code finally but for some reason none of the NSLog calls seem to execute except the one immediately before [mobdefs cr...

Objective-C memory leak confusion

Obviously the following in the main method should lead to a leak: NSMutableArray *strings = [[NSMutableArray alloc] init]; [strings addObject:@"Hello"]; [strings addObject:@"Howdy"]; return 0; and the clang LLVM reports the leak. However, working through the Hillegass book, I tried analyzing the following code, which again does not r...

memory management: should I release if a Copy method returns empty?

I call ABAddressBookCopyPeopleWithName(book, fullname); which is supposed to return an array of ABRecords for all the names that match 'fullname' from the AddressBook. Since this has a 'Copy' in it's name, it's returning with a retain count of 1 which I should release. What if it couldn't find any matching names? Should I still release ...

UIActivityIndicator not showing up

I have implemented a UIActivityIndicator that shows up in one part of my program but not another. I have the activity indicator come up while i am loading a table, however, i am trying to get it to start animating again after the user has clicked a button and is waiting for the table to reload. The table reloads, but no indicator. Here i...

How to make iPhone OpenGL ES context update straight away?

I have an OpenGL ES application for the iPhone I am developing, being a port of a 2d-oriented application from another platform. I have chosen to render the graphics using OpenGL ES for performance reasons. However, the main application runs on a separate thread (due to the original application design), so from within my app delegate I d...

pathForResource? without using extension (Iphone)

Hi, Here is what I'm doing, when I create an image with the path in the bundle: UIImage *image = [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"image" ofType:@"jpg"]]; What I want to do is trying to find the path for my image but without using the extension, without using 'ofType' (because the name of my i...