objective-c

How do I add a UIImage to grouped UITableViewCell so it rounds the corners?

I'm trying to add images to table cells in a grouped UITableView but the corners of the images are not clipped. What's the best way to go about clipping these (besides clipping them in Photoshop? The table contents are dynamic.) ...

Problems when using Quartz 2D on NSOperation

Hi! I need to paint an image using some data and show it on my iphone application. Since the painting takes significant time (2-3 seconds on device), I want to perform painting on a different thread. Also, I want to be able to cancel painting, change something in data and start it again. So it's best for me to use NSOperation. Now, when...

Method signature for a Selector...

Hi, I'm new to the Objective C business (Java developer most of the time) and am woking on my first killer app now. :-) At the moment I am somehow confused about the usage of selectors as method arguments. They seem to be a little bit different than delegates in C# for example. Given the following method signature -(void)execute:(SEL)...

switching between 2 different view controllers that are presented modaly

Hello guys, I have a main UIViewController that is create at startup that I only use to switch between 2 different view controllers that are presented modaly. Here my code that does the switch: - (void)imagePickerController:(UIImagePickerController*)picker didFinishPickingMediaWithInfo:(NSDictionary*)info { [self dismissModalView...

Formats for communicating between backend and Objective-C/Cocoa

I'm developing an iPhone app that is connected to a backend server. It needs to communicate with it many times, through several requests. I'm sending HTTP messages, but I want to receive more complex responses that I can parse somehow. Supposedly, I can provide any type of format for responses from the server, so my question is: which on...

Best way to split and convert url params into string values

Hi I would like to split a custom url for app opening in iPhone into values, my scheme would be something like: appname://user=jonsmith&message=blah%20blah Where I would like to be able to get "user" and "message" as two NSStrings. Any advice on best approach? ...

Image processing on the iPhone

I would like to apply image processing on pictures taken on the iPhone. This processing would involve 2D matrix convolutions etc. I'm afraid that the performance with nested NSArrays would be pretty bad. What is the right way to manipulate pixel based images? Should I simply use C arrays allocated with malloc? ...

Problem to destroy or tweet (inReplyTo) with the MGTwitterEngine- Can´t pass the right NSNumber to the methods

Hi, I hope I don´t annoy you and you don´t have to answer this, but here is a little bit more explanation of my problem. I got all of the ids of the tweets with a NSArray. Then I set a NSNumber with: NSNumber =[NSArray objectAtIndex:indexPath.row]; to get the right id of the tweet in the TableView row. Now I just wrote this: unsig...

Can´t get the unsigned long value of a NSNumber

Hello, I want to get the unsigned long value of a NSNumber. I don´t know why, but it doesn't work. Here is what I did: NSString * stern = [idd objectAtIndex:indexPath.row]; // get a String with Number from a NSArray NSNumberFormatter * lols = [[NSNumberFormatter alloc] init]; NSNumber * iddd = [lols numberFromString:stern]; NSLog(@"%@",...

Question regarding iphone allowance of custom notifications

I have an app that I am working on, and part of its main functionality is to alert the user to do something. So even though they aren't in the app, I want to be able to pop up an alert from the app, reminding them to do something. Is that allowed with the iPhone sdk? Maybe it isn't even a big deal at all, but for some reason I was thinki...

MallocDebug "Unable to read malloc information from (null)"

I have a certain .app built in xcode (version 3.2.1) as a Release build. I open MallocDebug and browse to the build directory, selecting the Release build and clicking the .app file. I then hit "Launch". MallocDebug then seems to freeze, giving me the spinning beachball for a minute or so, followed by the error message: Read Data "Un...

How can I programatically set a TableView to be grouped

I am trying to set up my TableView dynamically froma configuration file and have been trying to override the following template code - (id)initWithStyle:(UITableViewStyle)style { // Override initWithStyle: if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad. Jea...

Using sudo commands in Cocoa and Objective-C?

What is the proper way to run something like $sudo touch folder_name or $sudo rm from within Objective-C/Cocoa? I'm changing and moving around a few files and need elevated privileges. Any code sample would be greatly appreciated. Thanks. ...

Question regarding core data and the camera.

So I am working on an app that uses core data to store attributes of objects that the user can set. I have primarily been focusing on the first part, which was setting everything up on the core data side, and now I am ready to move on to the next part which deals with the camera. I want to be able to add a city, or other geographical loc...

UITextView highlightedTextColor or similar option?

I have a custom UITableViewCell with a UILabel and a UITextView in it. I want the text for both of these to appear white when the user highlights the UITableViewCell. It's obviously very simple to set the highlightedTextColor of the UILabel, but the UITextView doesn't seem to have any similar type of property. Am I going to have to man...

Call instance method from class method

Hi dudes, and dudetts! So I need to call some instance methods from class methods in objecitve-c... Example : +(id)barWithFoo:(NSFoo *) { [self foo]; //Raises compiler warning. } -(void)foo { //cool stuff } So my question; StackOverFlow is how do you do such things in Objective-C, I'm new kinda to OOP, so am I mad, or is there a ...

How can I get information about who called a method?

I'd like to get some information on who called a particular method. Namely, if possible, getting the line number and file name of the method that made the call. Akin to FILE and LINE, except one level down in the stack. This is possible in high-level languages, but any way to do it in Objective-C? - (void)myMethod { NSLog(@"I was...

Cannot strip newline from Cocoa NSMutableString ...

Hey, for the life of me, this is not working:.. NSMutableString *b64String = [[[NSMutableString alloc] initWithFormat:@"Basic %@", [string _base64Encoding:string]] autorelease]; [b64String stringByTrimmingCharactersInSet:[NSCharacterSet newlineCharacterSet]]; NSLog(@"(%@)", b64String); NSRange foundRange = [b64String r...

Unfamiliar with technique to solve pre-populating textfields (w/out access to a viewDidLoad or similar method) on Mac Desktop

Hey, I have a mainMenu.xib - that sets up all my interface items (button, textfields, etc). I have a LogController that has access to all these items via IBOutlet and IBAction. Works fine - All connected and running well. However, I want to have NSUserDefault values pre-populated in the textfields. However, I can't figure out how - si...

Releasing NSArray containing NSDictionary objects

I am having difficulty getting my head around memory management in the following segment of code on iPhone SDK 3.1. // Create array to hold each PersonClass object created below NSMutableArray *arrayToReturn = [[[NSMutableArray alloc] init] autorelease]; NSArray *arrayOfDictionaries = [self generateDictionaryOfPeople]; [arrayOfDiction...