objective-c

referencing views iphone

Hi, my app has a menu with an assortment of buttons at the bottom, each button inserts a new subview from one of my xibs, underneath the menu. The views have an order they are supposed to go in(think powerpoint presentation) though the user can touch a certain button to go to any of them. There are also next and previous buttons. I am...

NSString read/write to file

Hi all Im just having trouble reading and writing NSString to a dat file on the iphone. NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex:0]; NSString *saveFile = [documentsDirectory stringByAppendingPathComponent:@"Profiles.dat"]...

Socket connection from Java to Objective-C

I'm implementing a server push via a socket connection to an Objective-C based application. I'm at the point where I'm sending my data through an outputstream on the socket but I need to reassemble the data on the Objective-c end. At this point I haven't even looked at the objective-c IO classes and I am wondering how can I ensure maximu...

Objective-C: Substituting empty string for NSNulls in a constructor

I have a NSDictionary containing attributes I got from deserializing a JSON structure. I would like to initialize an object with these attributes, but replacing all the NSNull values with an empty string (all the object properties are strings). The object is being managed with Core Data. I'm new to the language, so I'm not sure what's t...

Programatically scroll a UIWebView iPhone SDK

Hi does anybody know how I can programatically scroll a UIWebView in Objective-C (iPhone SDK)? The only solution I can think of is to put it inside a UIScrollView and programatically scroll that, however this presents the problem that the web view is often the wrong size and therefore the bottom of the page is cut off when scrolling. I ...

NSArrayController : removeAllObjects does not refresh TableView

In my application I add objects directly to an ArrayController. When I want to clean all items I do: [[downloadItemsController content] removeAllObjects]; This command however does not refresh the TableView the arraycontroller is bound to. If I remove all items and add another new items I only see that item. That is fine but if I don'...

PyObjC giving strange error - [OC_PythonUnicode representations]: unrecognized selector sent to instance 0x258ae2a0

I have this line: NSWorkspace.sharedWorkspace().setIcon_forFile_options_(unicode(icon),unicode(target),0) Why does it give that error and how do I fix it? Thank you. ...

show the keyboard of a textfield on top of the screen

In my iphone apps, my problem is that I have a textfield at the bottom of the screen, so when the keyboard appear, he hides the textfied, there is a way to show the keyboard on the top of the screen? thanks, Alex ...

Using NSURLCredentialStorage with a synchronous NSURLConnection

I am having a problem very similar to this question here: Can I use NSURLCredentialStorage for HTTP Basic Authentication? The author of that question accepted an answer but later posted that the solution code was returning NSURLErrorUserCancelledAuthentication errors. I am using DIGEST authentication, but otherwise my code is doing the ...

Objective C objects behaving strangely (using old references)

I'm getting so very strange behavior in my Objective C library (for iPhone). What I'm trying to do is take packets coming in (off of the accessory port), append them into a NSMutableData instance variable, and then check that to see if I have any complete packets. If I do, the [containsPacket] method will return the length of the packet,...

How To Extract Information from NSArray Generated from Core Data NSPredicate?

Hi, I am using Core Data to develop an application, and I have used a NSPredicate to 'query' an entity which returns an NSArray of results, as is standard. The NSArray contains objects of 'EntityA' which itself contains attributes 'AttributeA' and 'AttributeB'. My question is, how can I extract information from this array? Furthermor...

memory mgmt problem in complex dictionary

I hate asking memory management questions - all the good answers are variations on RTFM. But this one is stumping me. I have a (relatively) complex dictionary in my model class, where each key points to an array of arrays. I constantly add and delete items to it, depending on state. Each "item" is an array. - (void)addToDictionary:(NSN...

Using Multiple NSUInteger enums as a parameter to a method.

Hi, I'm trying to make a method with a similar format to the setAutoresizingMask: method of NSView. I want to have someone be able to specify multiple values that i declared in my enum (NSHeightSizable | NSWidthSizable) like in autoresizing mask. How can I do this? ...

Objective C code in LATEX listings

Hi everybody, I'am searching for a way to use objective C in LATEX. I want to display the same syntax highlighting in LATEX as it is in XCode. I tried it this way: \lstset{language=[Objective]C,label=code:MyCodeLabel,caption=A small caption,name=code:MyCode, breakindent=40pt, breaklines} \begin{lstlisting} NSLog(@"Test it: %@",[[[[...

How do you past values between classes in objective-c

How do you past values between classes in objective-c? ...

How to draw a moving laser beam?

I'm looking to draw a laser beam which can possibly bounce around a box. Basically the laser beam is of variable length and when it bounces off a surface it will reflect at the angle that it collides. I can handle the collision stuff myself (probably, haven't tried it yet though), but I'm confused about how the actual drawing would work...

How do I access the data source in my NSTableView to allow editing of a row in the table?

I'm trying to access the array (data source) in my NSTableView to allow replacing the string that is in the row with a new string.The app consist of an NSTextfield for data entry and a button to add the entry so that it's displayed in the NSTableView. What I want is to be able to double click the NSTableView and replace what ever string ...

Drawing a transparent circle on top of a UIImage - iPhone SDK

I am having a lot of trouble trying to find out how to draw a transparent circle on top of a UIImage within my UIImageView. Google-ing gives me clues, but I still can't find a working example. Are there any examples that anyone knows of that demonstrate this? ...

iPhone Objective-C: If string contains...?

How can I tell if a string contains something? Something like: if([someTextField.text containsString:@"hello"]) { } ...

Objective C: Blocks vs. Selectors vs. Protocols

I frequently find myself writing "utility" classes that can be re-used throughout my projects. For example, suppose I have an "Address Book" view. I might want to use my address book to select who gets sent an email, or maybe who gets added to a meeting request. I'd develop this view controller so it can be used by both the email co...