objective-c

How should I wrap a custom NSView in an NSScrollView?

Hey stackoverflow, Cocoa's NSScrollView is horribly under-explained. I hope someone here knows what it's all about and can spare me a few seconds. So I have a custom NSView. I implement -drawRect: for it to draw something, fill itself with colour, whatever. Then I have an NSScrollView wrapping it (set up through the interface Builder)....

How to load several nib files with NSBundle loadNibNamed: ?

I'm trying to have my view hierarchy loaded through calls to loadNibNamed. For a single nib, in my ApplicationViewController : UIViewController : - (void) loadView { [super loadView]; [[NSBundle mainBundle] loadNibNamed:@"ApplicationViewController" owner:self options:nil]; } But then in Su...

NSCFDictionary objectForKey unrecognized selector sent to class

After I call a SOAP webservice asynchronously using WSMethodInvocationSetCallBack and WSMethodInvocationScheduleWithRunLoop I get the result in the following callback function and begin parsing it void wsCallback(WSMethodInvocationRef invocation, void* info, CFDictionaryRef data) { const void *data = CFDictionaryGetValue(resultBody, (NS...

How to raise an event in Objective-C

Hey, I'm a little confused about raising an event in Objective-C, I came from C# (.NET) environment and I would like to learn Objective-c and Cocoa programming. So here's my question: I have a little application with a NSTextField that I want to use to listen to an event. What I want to do : When I double click within this control, ...

Why is my window disappearing ?

I'm writing a program in objective-c but when I build and go the window is not loading. I can click on the .xib file and tweak the interface but when I run the program the GUI is not loading. Any ideas on why this is happening. NOTE: I do see a menu bar that shows that my application is running but the GUI is not visible. ...

Objective-C Loop Through NSMutableArray?

Hello! Very simple question - how might I iterate through a NSMutableArray and do things for each item? Much like the for loop in other langs: foreach(array){ dosomething(); } Thanks! Christian Stewart ...

UISwitch and UITableViewCell iOS4

Hi All, Caveat: I have looked for the answer to my question and several come close, but I'm still missing something. Here is the scenario: I want a way to create UITableViewCells that contain UISwitches dynamically at run time, based on the data in a table (which I can do). The problem becomes connecting the switches such that I can...

Dragging Files to NSStatusItem

I was told that the application:openFile: delegate method for NSApp would allow my application to open files by dropping them into the dock, but does this also apply to NSStatusItems in the menu bar? I would like to know before trying to implement. ...

How do i load a new xib on an orientation change on the ipad?

How do i load a new xib on an orientation change on the ipad? ...

Configuring conditional code in a subproject

I have a project that has a library subproject that gets imported. I have access to the source code of both the main project and the subproject. The subproject uses Core Text. Because the subproject must be used on pre and post 3.2 applications, Core Text is weak linked and all of the Core Text related code is wrapped in the logic: #...

xml string to file using Objective C

How i can make an xml file from NSString object? In other words, how can I parse XML from an NSString object? ...

Controlling what gets pasted into NSTableView

A user selects a song in my mp3 player. He proceeds to rename a song (thus highlighting the "name" column of that given song). Let's say he pastes in "The\nGreat\nSong". By default, if the string formatter doesn't allow newlines (which is what I want), the app will produce a beep. How can I process the string before it is pasted? This ...

What books to buy? Objective-C biased...

I'm trying to learn Objective-C, specifically with regard to iPhone programming. I've done programming at A level, which was 6 years ago now, and I dabble with some stuff every now and then. I was wondering what books people recommend to teach myself - I don't have a very good grasp of OOP, things like KVC/KVO (is this just ObjC?), and r...

Objective C - How can I create an interface class?

I need to be able to create an interface like you create in C# to enforce a group of classes to implement certain methods. Is this possible in objective c? ...

Objective C - what does & sign mean when used in objective c?

what does & sign mean when used in objective c for example? int i = 1; NSData *data = [NSData dataWithBytes:&i length:sizeof(i)]; ...

Objective C - remove drawing

Hi, I've been using the code below to draw on an UIView CGContextRef context = UIGraphicsGetCurrentContext(); CGContextSetStrokeColorWithColor(context, [UIColor blueColor].CGColor); CGContextSetRGBFillColor(context, 0.0, 0.0, 1.0, 1.0); CGContextSetAlpha(context, 0.5); CGContextSetLineWidth(context, 10.0); CGContextMoveToPoint(context...

How to move from xib to xib

What is the better code to move from "page" to "page"?I have a questionnaire on 4 pages and I loading 4 views from 4 xibs. I picked up 2 way of moving from xib to xib (in my case, from page to page). Method 1: -(IBAction) MaleTapped: (id) sender { Page1M *ivc = [[Page1M alloc] init]; UINavigationController *nc = [[UINavigation...

Cannot addObject into a NSMutableArray?

Hi, everyone, I have a question about the objective-C. I use the following code to add a contains from an array to another array. However, the second array is null. Can anyone help me? Thank you. titleArray = [[csvDataArrayString objectAtIndex:0] componentsSeparatedByString:@","]; NSString *title; dataTitleArray = [[NSMutableArray al...

Why isn't this NSMutableArray getting populated?

I have an NSMutableArray I am trying to populate using a for-loop and making NSStrings for it. These are to be the data source for my UIPickerView. You'll see some commented out lines where I manually made NSArrays and they showed up fine, but my for-loop NSMutableArray doesn't seem to accept the strings I'm making. The NSLogs show th...

Convert quoted strings in a CSV to an NSMutableArray without the quotes.

Hi, everyone, I have a question about the objective C. I have the following NSString *name shown below: "First Name","Second Name","Last Name"; Actually, name is the header of the CSV and receive from the URL. And I use the follow statement to break the statement to array. NSMutableArray *csvTitleArray; csvTitleArray = [[name compo...