objective-c

Lego Mindstorm NXT, Cocoa, and HiTechnic Sensors

I've taken the existing code from this project, and very happy with it so far. I'm now however in a position where I need to make use of some third-party sensors which I've purchased from hitechnic, such as an accelerometer, a gyroscope, and a 3D compass - to mention a few. I'm not sure where to start now, but what I need to do is add ...

Custom Mac Scrollbars With Cocoa

How would I create custom scroll bars with cocoa? ...

How to "Build and Run" without attaching to gdb in Xcode?

For both iPhone and desktop applications, when you choose "Build and Run" from the Run menu (or press cmd+return), Xcode launches gdb and then runs the application with gdb attached. This allows you to inspect stack state if the program crashes but adds significant overhead to program launch time, which is somewhat useless if your progra...

Objective-C: variable optimized away by compiler

I am trying to run the following code: 1. NSURL *checkLicenseURL = [NSURL URLWithString:@"check_license.php?accesskey=&license_key="]; // call server API 2. NSError *err = nil; 3. NSXMLDocument *xmlResult = [[NSXMLDocument alloc] initWithContentsOfURL:checkLicenseURL options:NSXMLDocumentTidyXML error:&err]; But when looking at variab...

Objective-C: How to cast a boolean as an object for use with NSKeyedArchiver

I need to cast a boolean as an object, or NSKeyedArchiver throws a memory access error. What's the best way to do this? ...

how to implement view hierarchy using segmented control?

I want to implement something like this.Main screen shows login info.After login i want to show a view with 4 buttons in upper part of view.Names button1,button2,button3,button4 The first time view appears i want to show a view below buttons.And by clicking each button show different views? BTW for buttons i took UIsegmentedControl in a...

Using NSWindowController to manipulate a window

I have the following code: AXWindowController *controller = [[AXWindowController alloc] initWithWindowNibName:@"ActivateWindow"]; [controller showWindow:nil]; How do I use controller to make changes to the window ActivateWindow (eg. changing text on the window, etc.)? Step by step instructions would be appreciated. Thanks! ...

Deleting a tableview cell with swipe action on the cell.

Hi all, Is it possible to delete a cell with swipe action on it ? Or are there any other methods for doing so ? Need Suggestions . Thanks ...

Objective C + out of scope error

Hello, I am declaring a static NSString in .h file as: static NSString *bowlerName; @interface PlayMatchController : UIViewController <UIActionSheetDelegate> { ...... } @end In the .m file I am assigning that NSString variable with some value: bowlerName = @"ABC"; Later in the .m file when I try to access that variable using the ...

Traceroute in Objective-C

Does anyone know of a code sample in objective-c for traceroute? NOTE- I am looking for a code implementation of traceroute/tcptraceroute, NOT a utility. ...

How to get all the videos thumbnails and information shown in Youtube channel?

Hi all, I have a simple application which has to show the thumbnails of videos present at a particular channel and the links associated with them in a tableview, I have integrated google data api in my application also but I am unable to proceed further, I have also seen same type of question at this link But I am not able to get the c...

How to fetch only first entity from Core data?

Hi, everyone. It may looks like a newbie question, but I really am. I try to fetch only first object from Core data. But I try to figure out how could I done this? For example, it may have 100 object in Core data for specific entity. I just need the first one. Could you give me your advice? ...

NSArray element comparison to NSString

Hi, I am trying to find a word inside a phrase (NSString). For this I've exploded the components of the phrase into individual substrings and now I am trying to compare them to the word I am looking for, but it doesn't work. What would be the correct approach for this and fix for the software below? NSString *myString = @"Mi Programa...

obj-c access property dynamically

I know the string name of a property of an object. How would one go on about getting and setting that property using the string? ...

Adding a category to NSArray

I added a category to NSArray with a helper method for sorting. My unit tests all pass, but when running the app in the simulator it blows up. Could this be because of the NSMutableArray / NSCFArray class cluster stuff? Here is the error: 'NSInvalidArgumentException', reason: '* -[NSCFArray sortBySequenceAsc]: unrecognized selector se...

Adding item to NSMenu with action selector preset

I'm new to Obj-C/Cocoa programming, and I'm having an issue trying to dynamically add menu items to an NSMenu instance and have the items action selector already set upon insertion. I can, add the dynamic menu items fine, but the action selector doesn't trigger when the item is clicked via the menu. The first line below is the line of ...

What is the standard way to write a method declaration in Objective C?

I have a question about the first paramater in Objective-C -(NSInteger) totalSeconds:(NSInteger)h minutes:(NSInteger)m seconds:(NSInteger)s; I've noticed that it seems the first paramater is often 'pulled into' the message name itself and is not named. [totalSeconds:9 minutes:59 seconds:59] Is this kind of syntax acceptable: -...

How can I determine the "caller" of my method in Objective-C?

So I have a rather complex application that I've, perhaps naively, agreed to "debug". Upon entering into a certain method, I'd like to print out as much info about who called the method, from which class, method, etc. it was called from. Any suggestions would be very much appreciated!! ...

It's possible to get a attribute from NSEntityDescription using a NSString?

Hello There! Im getting the value of an attribute using NSEntityDescription.attributeName, like this: NSEntityDescription *edCurrentRecord = [maListRecords objectAtIndex:indexPath.row]; UILabel *lblCell = [[UILabel alloc] initWithFrame:CGRectMake(5.0, 10.0, 280, 20.0)]; [lblCell setText:edCurrentRecord.name]; There is another way to ...

How to code smooth scrolling for "flick" gesture on iPhone

I have horizontal list for which I'm implementing my own scrolling logic. I have the "touch and drag" scrolling working great, but I'm having trouble with the "flick" gesture. All the built in scrollable views have the feature that if you "flick" the view it scrolls faster or slower based on the intensity of the flick. Does anyone has a...