objective-c

Any "fundamentals-oriented" example of NSScroller out there?

I'm looking for some kind of a basic, straightforward example of how to work with a pair of NSScrollers in an NSScrollView with a custom NSView. There are sporadic examples out there, largely consisting of contrived examples using programatically created interfaces, or based on the assumption that the developer is working with a typica...

Storing a list of Categorize URLs - Sqlite DB, XML, or pList? Structure Design?

Hey guys, I want to store a categorized list of URLs. This is an internet radio streaming app, and so I want to have at least three links for each genre: the free streaming URL with commercials the premium streaming URL at 128 kbps the premium streaming URL at 256 kbps So every genre will have these three URLs. For the premium strea...

Difference between operations & threads in Cocoa

Hello everybody, I am learning Objective-C, I will be developing a video processing application. I am reading the developer's guide on apple and I ran into Operation objects. I just need some clarifications what the difference between operations & threads, disadvantages, advantages, use cases. From what I read, operation is higher le...

When TableView's DataSource Array Changes, App Crashes

I have an array of 5 items that is also used as the content for a tableview. In the nib is a button that changes the content of the array to 5 different items. When I click that button, however, the app crashes with an EXC_BAD_ACCESS. I set a breakpoint on objc_exception _throw and had my suspicions confirmed. The bad method is - (i...

When I open a custom UIView from a UITableViewController, how do I close the custom view and go back to the table view?

I'm using a UITableViewController for a menu in a game. The table view opens a a view controller for my custom UIView that shows the game. When the game finishes the UIView is notified (which is kinda ruining the MVC principals) and from there I am kinda lost. Questions: Can a UIView communicate with its controller? How? Can one contr...

NSObjCMessageLoggingEnabled with iPhone 3.0

I'm debugging a program that was written for iPhone OS 2.2.1 and has to be slightly rewritten for 3.0. Having a list of all the Objective-C message calls that are being made, including "behind-the-scenes" calls, would be very useful. I found NSObjCMessageLoggingEnabled on a website, but am not sure if it works with the iPhone. Does ...

Programmatically loading an object model created using NSCoding

Version 1.0 of an application has a data model, which is saved/loaded using the NSKeyed(Un)Archiver classes, as all model classes adhere to the NSCoding protocol. Say the following hierarchy exists: -> Houses (NSMutableArray) -> -> House (Custom Object) -> -> -> Color (3 ints, RGB) -> -> -> Number of Residents (int) Say that there are...

Pass a class as a parameter?

I have been lead to believe that it is possible to pass a class as a method parameter, but I'm having trouble implementing the concept. Right now I have something like: - (id)navControllerFromView:(Class *)viewControllerClass title:(NSString *)title imageName:(NSString *)imageName { ...

Call Release in class or subclass?

My base class has properties that are used by a subclass. where should Release be called? In the original base class or the class that inherits it? ...

Timing Objective-C code

Hello! I would like to add some automated performance test to my Objective-C application. (This is a game, so that I would like to see the current performance of key parts of the engine by simply running a set of tests.) To do this I want to write some timing support routine, something like this: - (void) benchmarkSelector: (SEL) msg o...

Really Big Numbers and Objective-C

I've been toying around with some Project Euler problems and naturally am running into a lot that require the handling of bigger than long long type numbers. I am committed to using Cocoa and Objective-C (I need to stay sharp for work) but can't find an elegant way (read: library) to handle these really big numbers. I'd love to use GMP...

UITableView problem in iPhone os 3.0

I have created application in iPhone OS 2.2.1 which contains one table view and text view . Whole application is working fine in all iPhone OS version except 3.0. In iPhone OS 3.0 when I press next button then table view reloads so while reloading it shows some line in between the cells. So can any one suggest me what will be the prob...

What is responsible for releasing NSWindowController objects?

Lets say I display a window like so: [[TBAddTaskWindowController new] showWindow:self]; Where is the TBAddTaskWindowController object meant to be released? Is the generic solution to call [self release] in windowWillClose? It doesn't feel right to have any other object "own" the window, because it's meant to exist until the user c...

Dynamic primitive type property setting in Objective C

I am trying to write a library so that it is generic enough that its useful. The problem is that it needs to update properties of other classes, both the property and class should be dynamic. Now I can do it using public variables no problem, I just pass a pointer to the variable I want to update. However it would also be incredibly use...

NSXMLDocumentTidyHTML doesn't tidy some XHTML validation errors.

I want to grab text from a list of web pages. I've done a bit of experimenting and found that the best way for my needs is via WebKit. Once the source of the page has been grabbed, I want to strip out all the HTML tags, by using the technique in this comment. Here's my code: - (void)webView:(WebView *)sender didFinishLoadForFrame:(Web...

NSNotification userinfo example?

I have an array of objects that are positioned using CGPoints . At certain times in my app, an object in the array needs to notify other non-arrayed objects of its position. I understand that NSNotification is the best way to go, but I cant find a decent example of a 'sender' and 'reciever' for the notification that wraps and unwraps a C...

Countdown Timer

I'm trying to create a countdown timer that takes countdown, an IBOutlet connected to a textfield, from 60 seconds down to 0. I'm not sure A. How to limit the repeats to 60 and B. How to decrement the countdown in advanceTimer: - (IBAction)startCountdown:(id)sender { NSTimer *countdownTimer = [NSTimer scheduledTimerWithTimeInterval...

Display PlaceHolder Text

I have a countdown timer textfield that displays 60 as a placeholder (grey). When I start the timer, it goes black and starts counting down. At the end, I invalidate the timer and set the countdown textfield back to 60. Of course, it's black now. How do I get it back to the placeholder text of 60 (meaning that it's grey) without reso...

Loop through similarly-named Controls

I have view0 through view25. I don't particularly want to have a 25-case switch, so is there a way to do something like this? - (void)modifyViewNumber:(int)number { [view*number* dosomething]; } ...

Gracefully Halting NSXMLParser?

Hello there, still new to XML parsing with the iphone so i have a few questions. in my opinion, id like my iphone-app to have to request out to the internet as less as possible, so i have combined a few XMLs i had to a single, larger one. However when im parsing information out, it has some similar node-names (not at the same level o...