objective-c

UIScrollView - Figuring out where the scroll will stop

I'm trying to figure out how to calculate where the scrollview will stop when a user does a swipe gesture and the scrollview goes into deceleration. I'm trying to use the delegate functions, but I can't accurately figure it out. Please help! - (void) scrollViewDidScroll:(UIScrollView *)scrollView; - (void) scrollViewWillBeginDeceleratin...

methods using multi arguments

im a newb to objective-c i am viewing this video and the guy is talking about mutli argument setting in methods. i come from a background of php and many other languages. ive studied c in the past and the foundation language is pretty much the same across all languages. in a method like this: - (void) setTo: (int) n over: (int) d { ......

Calling a C++ object's method from an Objective-C child object

I have some Objective-C++ code that I'm trying to get events out of an Objective-C object to call a method within a C++ object. I'm very new to Objective-C, so I may be doing this all wrong. Example: @interface KnobClass { } -(void)Event; @end class DoorClass { public: KnobClass * knob; void start() { knob = [[KnobClass a...

Pressing tab in NSTextField selects all text instead of going to next control

I have multiple views all work fine but for some reason a view does not focus the next control when typing the tab key. Instead it selects all text of the current NSTextField. I am forgetting something really stupid here; can anyone help me on this? So it's an NIB containing a NSView. On the view are two NSTextFields, pressing tab in o...

How do I get data from an NSTableView?

I have an NSTableView with two columns and a data source that fills it with data. That part works. How do I get data (NSString format) out of the NSTableView? I can get the selected row but NSTableView doesn't seem to have methods for accessing data. Getting the data from my data source seems to return useless data (type id and NSLog()...

How do I implement audioStreamDesc.mSampleRate = audioStreamDesc.mSampleRate * 1.2; into my code?

I'm trying to make a sound mixer iphone app, but I can't seem to do speed control. I've looked over the posts, and this seems like the thing to do, but how do I implement it into the program? ...

NSTextView syntax highlighting

I'm working on a Cocoa text editor which uses an NSTextView. Is it possible to change the color of certain portions of the text? ...

How can you use circular #import to strongly typed objects in objective-c

How can you use circular #import to strongly typed objects in objective-c I have an audio controller class, a menu class and a gameview class. The application delegate sets up these classes and assigns a pointers so: the menu class is aware of the audio and gameview class the gameview class has a reference to the audio and menu class ...

Is there a callback to use to tell when the user's location is available

I'm after a callback or protocol that will notify me when the user's location is available. So that when a user's location is found I can zoom into where they are. What can I use to do this? I was thinking there waas something in CoreLocation that could do it, but I can't find how to do it. [Update] I've implemented <CLLocationManager...

UITableViewCell subclass not showing correct size

I have a nib file for a UITableViewCell subclass I made, it's height is set to 25 in the nib, however when the application loads, this is not the case. It loads to the default size. Here is my code for the implementation of the cell. // Customize the appearance of table view cells. - (UITableViewCell *)tableView:(UITableView *)table...

Ipod Library Access and subview removal in this code

I'm a 14 year old modifying an apple example code(my version can be found here for a school project, and I tried to put in ipod library access(It doesn't actually do anything yet, it's just supposed to show the access pop-up thing) and I tested it on-device, but it doesn't work. XCode shows no errors, but it doesn't work, even OD. Any re...

Help with changing slider colors on an iphone

I need to change slider colors in my iphone app, and I put This: - (UISlider *)ratioSlider { UIImage *stetchLeftTrack = [[UIImage imageNamed:@"grayslide.png"] stretchableImageWithLeftCapWidth:10.0 topCapHeight:0.0]; UIImage *stetchRightTrack = [[UIImage imageNamed:@"grayslide.png"] ...

Toubleshooting mapkit performance

I'm plotting over 500 points on a map using mapkit. Zooming is a little jittery compared to the native google map app. I've discovered what is causing the slowness. I'm adding custom annotations so that I can later add different pin colors and buttons for detail views: - (MKAnnotationView *) mapView:(MKMapView *)mapView viewForAnnota...

Terminating the app due to uncaught exception in Objective-C for iPhone app

Hello, i've written a for loop in Objective-C, This is how my code looks like NSString *string = [NSString stringWithContentsOfFile=@"/Users/Home/myFile.doc"]; NSString *seperator=@"\n"; NSArray *mainarray = [string componentsSeparatedByString:seperator]; // Since i want to parse each element of mainarray for(NSString *s in mainarray) {...

How to send and recieve data along with the event in Objective-C?

Hi, I created a program to send and receive events through NSNotification. Now i need to send data along with the event. Can anyone suggest me how to do this in coding in Objective-C?? ...

nesting "alloc" with a setter in Objective-C

Hi, first question here, this is regarding the iPhoneOS3 not MacOSX. I am fairly new to Objective-C and I've never developed in a environment without automatic garbage collection so I am a little confused by this. Here's some valid code assigning a view controller to an app delegate from an example off Apple.com: MyViewController *aView...

Why is a documented NSDateFormatter init method not getting recognized?

I'm getting this warning (below) when trying to use NSDateFormatter. I am importing in my .h file so what is the prob? (Oh, and the same method generates an error (unrecognized selector sent...)) Here is the WARNING: warning: no '-initWithDateFormat:allowNaturalLanguage:' method found Here is the Code: NSDateFormatter *myFormatter ...

How to determine if a UIView has a delegate that conforms to a protocol

Howdy all, I have written a custom class that depends significantly on touch dragging/positioning, outside of it's own view boundaries. There is an associated protocol defined with various relevant methods. An example of something that would use this protocol would be a view that allows things to be dropped into it from my custom class....

How to encode/decode a CFUUIDRef in Objective-C

I want to have a GUID in my objective-c model to act as a unique id. My problem is how to save the CFUUIDRef with my NSCoder as its not a an Object type. I keep playing around with the following lines to encode/decode but I can't seem to find any good examples of how to save struct types in objective-c (all of my NSObject types are enco...

How to add the value of string into hashtable in iPhone coding?

for(NSString *s in mainarr) { NSString newseparator = @"="; NSArray *subarray = [s componentsSeparatedByString : newseparator]; //Copying the elements of array into key and object string variables NSString *key = [subarray objectAtIndex:0]; NSLog(@"%@",key); NSString *class_name= [subarray objectAtIndex:1]; ...