objective-c

How to display a text multilined inside a cell of a table in iphone?

I am new to iphone development.I am parsing a xml file and displaying the title, date, view and summary in each row of a table.The contents of summary is big ,so only first 3 words are displayed in the cell. I increased the height of the row.Still 3 words are displayed in my cell.How summary should fit properly inside the cell and full c...

Does Instruments' memory leak tool have issues with 'for' loops?

Running my app in the simulator under Instruments to check for memory leaks, it seems to be indicating a leak in this block of code: for (NSDictionary *messageDict in messageDataArray) { message = [[Message alloc] init]; ... set some properties on the 'message' object [messages addObject:message]; [message release]; } ...

Connecting to server using bonjour in Objective-C

Hi, I am relatively new to iphone development. I have looked through the documentation and cannot really find an answer to this problem. I have a server which I have created and know the ip address and the port it is using. I am now trying to connect to this using an iphone application I am creating. Through the documentation there are...

Picker, access to dataSource?

I am just learning how to setup a multiple picker and I am a little curious about the two labeled sections below: // METHOD_001 NSInteger row_001 = [doublePicker selectedRowInComponent:0]; NSInteger row_002 = [doublePicker selectedRowInComponent:1]; NSString *selected_001 = [pickerData_001 objectAtIndex:row_001]; NSString *selected...

Loading a nib file without a NSWindowController?

I have a nib file I want to open up, but it is just an info panel so I dont need any methods for it. Is there a way I can just open it. I am not in a class that is a subclass of NSWindowController. ...

Iphone Splash Screen

Hey mates, I am really trying to do my best but I can't really find out what's going wrong in my code. I made a lot of search but I guess I just can't understand some objective c basics ;) My first question is related to the code below : [window addSubview:tabBarController.view]; UIImage *image = [UIImage imageNamed:@"lol.png"]; UII...

IKImageView and scroll bars

I have an NSScrollView with an IKImageView inside to display images. This seems to work. However, if I make the window smaller than the image, the scrollbars appear as they should, but the BOTTOM of the image is locked to the bottom of the window, instead of the top of the image being locked to the top of the window. In other words, I w...

Check if path is folder/bundle/alias in ObjC.

Hi, I come from the AppleScript land and there we use alias of (info for thePath) package folder of (info for thePath) folder of (info for thePath) to see if a path is either of the above. But I can't seem to find out how to do it in ObjC/Cocoa. I'm pretty sure it's quite easy but I fail to find any info about it. Thanks... ...

CFNetwork still passing CFStreamErrors even though its deprecated?

I'm writing some code that is wrapping up some CFNetwork stuff to do DNS resolution in Objective-C. Everything is fine and it's working, but I have a few questions: The callback function prototype for CFHost's asynchronous resolution is passing references to CFStreamError structures even though the documentation says CFStreamError is d...

Refering to the class itself from within a class mehod in Objective C

I hope i did not skip this part in the ObjC manual but is it possible to refer to a class from within one of its class methods? Like in PHP you would use "this" to refer to the current instance, while "self" refers to the instance's class the ObjC equivalent of "this" would be "self", so what would be the ObjC equivalent of PHP's "self",...

Need to convert NSData to NSArray

I am pulling down a plist from a URL using an NSURLConnection, which returns an NSData object. I would like to convert this to an NSArray. Can anyone help me? I am refactoring a method that currently does a synchronous request to the URL, using arrayWithContentsOfURL: to get the NSArray. Thanks!! ...

Alert noise for iPod touch 1G

Hello. I know the iPod touch 1g does not have a speaker like the 2g, and the iPhone, but I do know that it has a small speaker, capable of making various beeps. Is there a way to make the iPod touch 1g beep, or does it only work on 2g and above? If so, what would the code be? Thanks, HiGuy ...

How would I implement something similar to the Objective-C @encode() compiler directive in ANSI C?

The @encode directive returns a const char * which is a coded type descriptor of the various elements of the datatype that was passed in. Example follows: struct test { int ti ; char tc ; } ; printf( "%s", @encode(struct test) ) ; // returns "{test=ic}" I could see using sizeof() to determine primitive types - and if it was a full ...

iPhone Or Mac Header File?

Hello all, Just a small question... How is it that you tell the difference between an iPhone header file which you can use in conjunction with iPhone development, or a mac specific header file. Many thanks, Stu ...

When does setting an Objective-C property double retain?

Given the following code @interface MyClass { SomeObject* o; } @property (nonatomic, retain) SomeObject* o; @implementation MyClass @synthesize o; - (id)initWithSomeObject:(SomeObject*)s { if (self = [super init]) { o = [s retain]; // WHAT DOES THIS DO? Double retain?? } return self } @end ...

Accessing parentViewController's variables

I want to allow a pushed to set parentViewController's instance variables. For instance, VC1 (the parent) has a bunch of textfields and what not which are filled from VC2 (the child). VC2 is pushed onto the stack by VC1. I've tried doing like parentViewController.myString = "foo"; however since parentViewController is a UIViewController,...

@property and retain, assign, copy, nonatomic

As someone that's new to Objective-C can someone give me an overview of the retain, assign, copy and any others I'm missing, that follow the @property directive? What are they doing and why would I want to use one over another? Thanks ...

NSImage Crop Crashing

When I try to crop an image using NSImage's imageFromRect, I get an EXEC_BAD_ACCESS crash about 50% of the time. This is something that runs on startup (triggered in an awakeFromNib), so the environment shouldn't be changing. I am not sure why it crashes one one launch and not another. When I have a breakpoint set before I crop the image...

How to move a MKAnnotation without adding/removing it from the map?

Is it possible to move the coordinate of a MKAnnotation without adding and removing the annotation from the map? ...

How to get valid URL from the string ?

Hi guys. I am using NSURLConnection on the application. To create HTTP connection, I used following code : NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.mydomain.com/path/[email protected]"] cachePolicy:NSURLRequestU...