How to do an http get in cocoa on the iPhone
Hi, can anyone paste some code on how to do a simple http get in cocoa? ...
Hi, can anyone paste some code on how to do a simple http get in cocoa? ...
Plenty of Objective-C classes return objects. Statements like [[instanceOfNSWhatever objectForKey:aKey] stringValue], for instance, appear all over my (and hopefully everyone else's code). How am I supposed to memory manage these "intermediate" objects? Were they just created or did they always exist? Can I retain them, and if I relea...
I'm trying to populate a UITableview with an array of cells. I usually do this from the viewDidLoad method but this time I want to populate the array based on location. Below is the first line of my interface: @interface RootViewController : UITableViewController { In the implementation file the viewDidLoad method looks like this: ...
How would I go about editing the memory of other applications using Cocoa? I know the editing has to be done as root, but how would I do it in the first place? ...
Hi all, I noticed this in Joe Hewitt's source for Three20 and I've never seen this particular syntax in Objective-C before. Not even sure how to reference it in an appropriate Google search. From TTTableViewDataSource: + (TTSectionedDataSource*)dataSourceWithObjects:(id)object,... { The "..." is what's throwing me off here. I'm assu...
Is there a way to observe changes in derived properties? For example, I want to know when a CALayer has been added as a sublayer so that I can adjust its geometry relative to its (new) parent. So, I have a subclassed CALayer, say CustomLayer, and I figured I could register an observer for the property in init: [self addObserver:self ...
I'm trying to load a uitableviewcontroller after a location is found. This also means after the viewdidload method. my class is extending a uitableview controller with this interface: @interface RootViewController : UITableViewController { in the implementation I try to do a reload of the table view with: [s...
The object in question consists of key/value pairs aka @property. Is there an elegant way to encode/decode this object to a dictionary? It seems brute force to manually pull out each attribute and create the dictionary by hand. ...
I'd like to have a similar ellipse as the Mail app in my iPhone app. A screenshot just for reference is here: http://dl-client.getdropbox.com/u/57676/screenshots/ellipse.png Ultimately I'd like the ellipse with a numerical value centered in it. Is it best to use a UIImage for this task? Perhaps less overhead to draw it with Quartz? If i...
I want to send the data of a UIImage to the server through a socket, so I: a) open NSOutputStream - (IBAction)send:(id)sender { NSURL *website = [NSURL URLWithString:str_IP]; NSHost *host = [NSHost hostWithName:[website host]]; [NSStream getStreamsToHost:host port:1100 inputStream:nil outputStream: [oStream retain]; ...
I want to send out an NSArray, so I have to write it to an NSOutputStream first. The method should be : - (NSInteger)write:(const uint8_t *)buffer maxLength:(NSUInteger)length I can convert the array's pointer to uint8 _ t using : (uint8_t *)arr But how to get the length of bytes of the array? Do I have to save the array to a file an...
Hello, I want to display strings inside CoreAnimation layers, but unfortunately CATextLayer is not enough, mostly because it's difficult to use when using constraints and you want to wrap the text. I am using NSLayoutManager, using the following code (PyObjC): NSGraphicsContext.saveGraphicsState() # THIS SOLVES THIS ISSUE CGContextSe...
I have a grouped table view that utilizes two different custom table cells. When i scroll through the table so that one (or more) of the cells goes either above or below what is visible those cells become blank. When i scroll back up (or down) to view these cells they are still blank. Why is this? The cells showed the appropriate con...
I have a property that changes to invalid as I move between viewDidLoad and viewWillAppear. I have no idea why that happens. I have a helper class that gets the path to my database. I alloc this class in the app delegate. RootViewController gets a reference to the appDelegate like this: //inside .h file @interface RootViewController...
I would prefer to create my interfaces programatically. Seems as if all the docs on Apple Developer assume you're using Interface Builder. Is it possible to create these interfaces programatically, and if so where do I start learning about how to do this I thought the relevant document for this, if possible would be in this section: ht...
How can I determine if a Cocoa NSNumber represents NaN (not a number)? This emerges, for example, when I parse a string that has an invalid (non-numeric) contents. ...
Hi all, I'm trying to understand how strategies some folks use to distinguish instance vars vs. properties. A common pattern is the following: @interface MyClass : NSObject { NSString *_myVar; } @property (nonatomic, retain) NSString *myVar; @end @implementation MyClass @synthesize myVar = _myVar; Now, I thought the entire prem...
Has anyone spent any time comparing the various Objective C bridges and associated Cocoa wrappers for Mono? I want to port an existing C# application to run on OS X. Ideally I'd run the application on Mono, and build a native Cocoa UI for it. I'm wondering which bridge would be the best choice. In case it's useful to anyone, here ar...
Is there a simple way to create a selectable NSRect in Cocoa? In need a rectangle that can be selected and stays selected after a mouse click. Thanks. ...
I've created a mutable array containing NSRect values. I want to check whether the NSPoint I created is within this rectangle. What is the best way to do this in cocoa. ...