objective-c

Should I release this property?

I'm a objective c newbie, and i'm having a bit of problems with memory management, I've read the apple's memory management policies, however i need a bit of clarification here, this is pretty simple i guess, but i would like to ask you if I'm right: Given this property: @interface Test : NSObject { NSArray *property1; } @property (no...

Including multiple classes in the same header file

I have an idea on how to do this, but I want to make sure I do it right.... I have five data classes. When I use one I typically use all of them (but not always). Each class has a separate header file. I am getting sick of linking in each header file separately. What is the best way resolve this issue? ...

Objective -c properties - Can't change a subview's color with a declared property

I have a view with a subview whose alpha and backgroundcolor I would like to change through the use of declared properties. I have written some code as below and it works fine to change the alpha, but the background color is not changed when the property is set to a new value. Any help would be appreciated please. @interface MyView ...

Syntax coloring for Cocoa app

I'm planning to do a Cocoa app that requires code syntax to be colored (in all common languages). Instead of writing my own code highlighter/parser, are there any pre-made solutions available? Thanks ...

iPhone sdk - open app store to specific app?

Is there a way to open the app store to a specific application? I tried using something like the following: [[UIApplication sharedApplication] openURL: [NSURL URLWithString:@"http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=284417350&mt=8&uo=6"]]; But got the following: "Safari cannot open the page because to ...

Is there a way to create a scrollViewISZooming method similar to the scrollViewDidEndZooming?

I am looking for a way to create a scrollViewIsZooming method that is called while zooming is occuring. Does anyone know of a way to do this? I am wanting to use it to keep the content centered in the scrollView while zooming. If I use the scrollViewDidEndZooming method, the content snaps back to the center after zooming is finished. T...

Can I set the insertion point on a UITextField

I have a UITextField that I want to present to the user with a pre-filled suffix. Obviously, I'd like to have the insertion point set to the beginning of the pre-filled text. It doesn't seem obvious to me how to do this (there's no insertionPoint property), but is there a tricky way to get this done? ...

iPhone properties getting set to nil

I set a property with this declaration: @property (nonatomic,retain) NSDictionary *itemData; to a dictionary with 1 key - val pair. The table view in my view then gets the one value for the dictionary fine as a section header. But when I go back to access that very same value, it is nil. Any suggestions? I have been working on this f...

Objective C memory leak issue..

The Leaks instrument tells me that I have a leak in this code fragment. Why is this so? This code fragment is in viewDidLoad(). UINavigationItem *navItem=[self navigationItem]; UIBarButtonItem *addFeed = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(addFeed)]; [navItem setRi...

Character Conversion Still Not RIght (Objective-C)

FIrst, thanks to all who responded to my first two questions. I have tried what was suggested and still nothing works. I thought I would create another post with the code that I am using. Just for some background: I am creating a guessing game for my son and I need to change characters form character to decimal to character. I have ...

Displaying numeric value in label area of iPhone using stringWithFormat

I am new to Objective C and the iPhone SDK, and am trying to figure out the following as a simple example of displaying a numeric result in a label area: label.text = [NSString stringWithFormat: @"%d", 55]; This code above displays the number "55" in the label area. However, the following code results in the display of "0" (with calcu...

Is there a simple UIViewController that displays one photo?

I know three20 has a PhotoViewController but it seems like overkill to just include the whole framework just to load one picture from one URL. Does anyone know of any code/lib that displays one picture when give one URL? ...

JSON IPHONE: How to send a JSON request and pull the data from a server?

Hi, I know barely nothing about JSON and I need to send a request to a server and read the data coming from it, using the iPhone only. I have tried to use the jason-framework to do that, but after readin the documentations I was not able to figure out how to construct the object and send it on the request. So I decided to adapted anoth...

Objective C: How do I substring an email address in text field to firstpart separated by @

Hi guys, I have been scratching my head trying to find any resources on substringing an email address I get from a textfield into getting the first part before the @ symbol. Ive tried looking at the documentation, playing around with the componentsseparatedbyString. No luck. Thanks for your help in advance ...

how to mask an image using coregraphics?

i want to create an app in which i shoot a person from camera.then take only body of person not the background.i know that i need to use image masking.but don't know how to use it.could someone post a sample to do this. ...

How to change the width of UINavigationItem::leftBarButtonItem ?

Hi, is it possible to change the width of the leftBarButtonItem of the class UINavigationItem? The default width is actually to short for my strings and I would like to enlarge the item as I have no title. Best, heinrich ...

how to detect body in image in objective-c?

is there a way we can detect a person's body in the image and cut the only body part of the image. ...

how to create a global variable(linked list) in Cocoa?

please give me some examples.thanks a lot ...

Initialize NSArray with floats?

Is this a valid way to initalize an NSArray with float objects? NSArray *fatArray = [NSArray arrayWithObjects: [NSNumber numberWithFloat:6.9], [NSNumber numberWithFloat:4.7], [NSNumber numberWithFloat:6.6], [NSNumber numberWithFloat:6.9],nil]; It works and...

Web application programming using objective-c?

Just say you have a quite large and complicated desktop application written in objective-c/cocoa written properly in MVC. You then wish to replace the V and C so that it is a web application? Is there anything like Tomcat but for objective c? The closest thing I can think of is somehow convert the Model code into an apache module to lo...