objective-c

Requesting a callback using selectors

How would I declare a class that has a method/message that takes a selector, stores the value of the selector, and then calls the selector later on? ie if its called SomeObject it would be called like this: -(id) init { // normal stuff here o = [[SomeObject alloc] init]; return self; } -(void) checkSomething { [o check...

Who owns an NSWindowController, in standard practice?

I'm seeking further clarification after seeing http://stackoverflow.com/questions/1031715/what-is-responsible-for-releasing-nswindowcontroller-objects I'm writing a simple inventory management application for my nephews. I have a table view that displays the contents of their "library", etc. To add a new item to the library, they clic...

Is there a way to synthesize setters/getters for class variables in Objective-C?

I find myself declaring bunch of class variables and it is really tiring to write simple get/set methods for each variable. So, the question is how to synthesize setters/getter for class variables in objective-c? ...

Cocoa Applications Examples

Hi! I've been doing some cocoa since a week, and I'm getting kinda good with it. I did some tutorials, calculators, currency converter, etc... But I was wondering if there was any more advanced guide? Like build a RSS reader, or anything else... I dunno.. If you know any good resource for examples please tell me. PS: I'm reading som...

Assigning array references, incompatible types?

I have a custom class called ItemComponent. Another class has an array of them called subComponents. It's a property of the class: ItemComponent *subComponents[0]; Initially, it is set as 0, because not all objects will have sub-components. In the implementation, I have a method to add an ItemComponent to the property. The item is...

Optimize SQLite3 on iPhone

I have an app using SQLite3. It's running pretty well, but I would like suggestions on speeding up SQLite (write) access. Most of the database operations are writing triples (int, int, double) of numbers, about 20-50 triples per second. There is an occasional read, but is about as rare as hen's teeth (mostly occurs on loading only). Doe...

Radiobutton in iphone

hi, i am using radio button image (empty circle) in button to answer the question from 3 options, and the 3 options are radio button's. i have created 3 uibuttons programmatically in tableview delegate method cellforrowatindexpath. i need when one button is selected(with filled circle image) other one if selected before gets unselected. ...

How do I create a mutable array of CGImageRefs?

I want to keep a mutable collection of CGImageRefs. Do I need to wrap them in NSValue, and if so how do I wrap and unwrap them properly? Can I get away with using a C array? If so how do I construct it and how do I add elements to it later? Is it significantly more costly to use UIImages instead of CGImageRefs as the elements of the coll...

How to align messages in UIAlertView?

hi, i want to know how to set the alignment of delegate message of alert view. anyone has solution, plz reply with some code. ...

Adding tableview cells at a specific interval of time

I have a tableview. I need to add cells of the tableview at a particular interval of time after loading so that we can view loading the cells.How can i do this. Any idea will be greatly appreciated! ...

possible to center my image without it scrolling along or being placed at the top

Does anyone know if it's possible to center my image when using a navigationController. With this I mean the following. When I click on a cell everything is fine ( figure 1 ) figure 1. step 1 img441.imageshack.us/img441/5026/picture5t.png step 2 img70.imageshack.us/img70/3998/picture6a.png I go back and want to click another cell ,...

NSMutableArray addobject with malloc'd struct

I'm having trouble with a snippet of code. I'm trying to add an instance of CLLocationCoordinate2D to a NSMutable array using the addObject method, but whenever the line is executed, my app crashes. Is there anything obvious wrong with this code? The crash is on this line: [points addObject:(id)new_coordinate]; Polygon.m: #import "P...

Making a video player which takes instructions from a socket

I want to make a player which will play video files from local server and takes command to play stop and ff etc from a socket. I am able to make a player which uses QTKit framework, but when it comes to socket it did not load movie. I run the socket on another thread, and I also initialize QTMovie on the main thread but still it's not w...

own component... functions wont work

hi, i tryed to create a own GUI component with cocos 2d... i haved written a class (extends Sprite) ... this class initialize with graphics and a lable... if I create an instance of my class .. i can see my component but i can user any functions... i wrote a setLabel function .. but the lable change... i create a instance with this cod...

Proper way to modify an NSMutableDictionary instance variable?

Hello! I have an Objective-C NSMutableDictionary declared inside a class's @interface section, with getter/setter methods, like so: @interface myClass : NSObject { NSMutableDictionary *dict; } - (void) setDict: (NSMutableDictionary *) newDict; - (NSMutableDictionary *) dict; Inside some of my @implementation methods I want to mo...

Converting web page into UITableView

Hi! I have an UITableView and I want to populate it with data from this page: http://tvgids.mobi/gids/ned1.php I have this code: NSURL *urlll = [NSURL URLWithString:[NSString stringWithFormat:url]]; NSString *test = [NSString stringWithContentsOfURL:urlll]; UIAlertView *av = [[UIAlertView alloc] initWithTitle:@"LOL" message:t...

going to the top in UITableview doesn't work the second time

Hello all , I have a question concerning the following issue. I would like to return to the top of my tableview everytime I press a cell This is a piece of the code that does it. - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { .... ... ... [self.tableView setContentOffset:CGP...

NSTableView doesn't increase the number of elements in table?

Hi all, I've an NSTableView that uses the controller object for the NIB being displayed as the data source. I implement the NSTableView informal protocol. This NSTableView gets its values from Core Data. I startup the application, load all values I have in XML and then display them. My problem is, the NSTableView doesn't seem to add a...

UITabBar Badging

Any idea why this works: [[[[[self tabBarController] tabBar] items] objectAtIndex:2] setBadgeValue:@"Hello"]; But this doesn't? [[self tabBarItem] setBadgeValue:@"Hello"]; I would rather not have to provide an explicit tab bar index (2 in the code above). Also, is there a way to get the ta...

How do I create a login system for an iPhone application.

Hi guys, I'm trying to make a login system for my cocoa app. How would I do this? I know it involves SQL, but I know nothing of SQL. I want the user to register or login. It would be easier if apple had a source code for this kind of thing, but I don't think they do. Best Regards, Kevin ...