objective-c

NSTimer with constantly changing NSTimeInterval?

Hi Can anyone tell me if its possible to create a NSTimer with a constantly changing NSTimeInterval? Basically, I want to create just on NSTimer object, and then change the time interval depending on the swipe velocity. ...

Cannot find interface declaration for 'UIResponder'

Hi all, I am running into this issue when trying to compile code for an iPhone app that I inherited from a previous developer. I've poked around on a couple forums and it seems like the culprit may be a circular #import somewhere. First - Is there any easy way to find if this is the case/find what files the loop is in? Second - Its d...

Potential leak of an object allocated

Using the build and analyze of XCode I saw i have a memory leak in my code: - (NSString *) doIt { NSString *var = [[NSString alloc] init]; return var; } This is of course a simplified snippet of my problem where do i release the object? ...

Objective-C protocol vs inheritance vs extending?

I have a couple classes that have nearly identical code. Only a string or two is different between them. What I would like to do is to make them "x" from another class that defines those functions and then uses constants or something else to define those strings that are different. I'm not sure if "x" is inheritance or extending or wh...

Incorrect decrement of the reference count

I have the following problem: In one flow of the execution I use alloc, and on the other flow, alloc is not needed. At the end of the if statement, in any case, I release the object. When I do 'build and Analize' I get an error: 'Incorrect decrement of the reference count of an object is not owned by the caller'. How to solve that? UII...

What's wrong with how I'm using NSDateFormatter?

NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; dateFormatter.locale = [[[NSLocale alloc] initWithLocaleIdentifier:@"en_US"] autorelease]; [dateFormatter setDateFormat:@"EEE, d MMM yyyy HH:mm:ss zzz"]; NSString *dateString = @"Tue, 08 Jun 2010 17:00:00 EDT"; NSDate *eventDate = [dateFormatter dateFromStrin...

Objective-C 2D Interpolation

Has anyone come across an Objective-C equivalent to the MATLAB function interp2()? ...a 2D interpolation. Cheers, Brett ...

Custom UITableViewCell Best Practice?

I am always subclassing UITableViewCell's and drawing them in code. Is there a good tool to visually get rect sizes so I don't have to guess and check all the time? ...

Using drawAtPoint with my CIImage not doing anything on screen

Stuck again. :( I have the following code crammed into a procedure invoked when I click on a button on my application main window. I'm just trying to tweak a CIIMage and then display the results. At this point I'm not even worried about exactly where / how to display it. I'm just trying to slam it up on the window to make sure my Tra...

Drawing UITableViewCell in IB

Is it bad practice/not efficient to draw UITableViewCell in IB vs drawing in code? ...

Obj-C: Passing pointers to initialized classes in other classes

Hey all. I initialized a class in my singleton called DataModel. Now, from my UIViewController, when I click a button, I have a method that is trying to access that class so that I may add an object to one of its dictionaries. My get/set method passes back the pointer to the class from my singleton, but when I am back in my UIViewCont...

How do I get google protocol buffer messages over a socket connection without disconnecting the client?

Hi there, I'm attempting to send a .proto message from an iPhone application to a Java server via a socket connection. However so far I'm running into an issue when it comes to the server receiving the data; it only seems to process it after the client connection has been terminated. This points to me that the data is getting sent, but ...

Bring to front DatePicker on an UITextField

Hi, When an UITextField is firstResponder, I would like to bring to front an UIDatePicker (bottom part of the screen) without the "going down keyboard" (no call to UITextField resignFirstResponder). The aim is to process like UIKeyboard of UITextField which pop-up on nearly everything when it becomeFirstResponder. modalViewController s...

Get layout frame of NSView (i.e. ibLayoutInset)

I'm working on an Interface Builder-type app for interface design. I would like to be able to align NSView's along their layout frames. Is there a way to access the ibLayoutInset property from my code? ...

array retain question

Hello, im fairly new to objective-c, most of it is clear however when it comes to memory managment I fall a little short. Currently what my application does is during a NSURLConnection when the method -(void)connectionDidFinishLoading:(NSURLConnection *)connection is called upon I enter a method to parse some data, put it into an array, ...

Custom UITableViewCell not appearing when row height is set

I have a custom UITableViewCell which I have created in IB. My labels display when I don't over-ride: - (CGFloat)tableView:(UITableView *)tblView heightForRowAtIndexPath:(NSIndexPath *)indexPath however my content is squished. I want the height to be 120px so I have the following: - (CGFloat)tableView:(UITableView *)tblView heightFor...

Reading html with accented characters from a URL on iPhone

Hello, I'm having trouble extracting the html from a website which contains accented characters. Specifically, there are French characters on the site. Currently I'm using: NSString* html= [NSString stringWithContentsOfURL: [NSURL URLWithString: url] usedEncoding: &enc error:&error]; to get html from a URL. It works perfectly fine fo...

iPhone noob - different method types?

My apologies in advance for what is probably a really dumb question. I'm familiar (or at least getting familiar) with instance and class methods in objective-c, but have also seen method implementations that look like this: #import "Utilities.h" #import "CHAPPAppDelegate.h" #import "AppState.h" @implementation Utilities CHAPPAppDeleg...

Confused about copying Arrays in Objective-C

Lets say I have an array X that contains [A,B,C,D,nil]; and I have a second array Y that contains [E,F,G,H,I,J,nil]; If I execute the following: //Append y to x [x addObjectsFromArray:y]; //Empty y and copy x [y removeAllObjects]; y = [x mutableCopy]; What is the value of y? is it?: [A,B,C,D,E,F,G,H,I,J,nil] Am I performing the ...

iPhone XCode debugger 'print' of method calls returns (IMP) pointers instead of printing return value

Whenever I try to print the return value of a method in my XCode gdb console (and in the value formatters), I keep getting (IMP) pointers instead of the return value. For example: print [alternateDepartures count] $9 = (IMP) 0x33725441 <-[NSCFArray count]+1> here, alternateDepartures is an NSArray of ints, as evidenced by: (gdb) po al...