objective-c

Finding where a method was called from.

How would I find out where a method was called from? Like you see in a stack trace. Basically, just to explain, I am observing a core data property and the method that gets called when the property changes calls another method (the IBAction) but in this IBAction it adds Core Data objects which triggers the KVO method which triggers the ...

Objective-C: How do you append a string to an NSMutableString?

http://code.google.com/p/mwiphonesdk/source/browse/#svn/trunk/iMADE/PrepTasks/08 URL Download I have code at the location at the link above and I am using NSMutableString to append strings as data is downloaded. But I am finding that using appendString does not increase the length of the mutable string. I must be doing something wrong. ...

Strange problem comparing floats in objective-C

At some point in an algorithm I need to compare the float value of a property of a class to a float. So I do this: if (self.scroller.currentValue <= 0.1) { } where currentValue is a float property. However, when I have equality and self.scroller.currentValue = 0.1 the if statement is not fulfilled and the code not executed! I found o...

Few questions: Lifecycle of UIViewController; release vs setting to nil.

I have a couple of questions relating to UIViewController: 1) When are each of the methods called for UIViewController? Specifically, the difference between viewDidLoad, viewDidUnload, and dealloc. 2) What's the difference, in general, when setting a pointer equal to nil and releasing the pointer? I know that in viewDidUnload you're su...

iphone SDK: Not understanding how to build a UIViewController super class?

I wanted to make a ViewController that had some text editing functionality I wanted through out my application. So, I did this. #import <UIKit/UIKit.h> @interface superViewController : UIViewController <UITextFieldDelegate>{ //these are instance variables, remember them? CGFloat animatedDistance; } @end Then, I add...

Accessing private variable from Category generates linker error

I have the following code: @interface UIAcceleration (Simulation) - (id) initWithTimestamp:(NSTimeInterval)aTimeStamp X:(UIAccelerationValue)ax Y:(UIAccelerationValue)ay Z:(UIAccelerationValue)az; @end @implementation UIAcceleration (Simulation) -(id)initWithTimestamp:(NSTimeInterval)aTimeStamp X:...

Rudimentary ways to measure execution time of a method

What object/method would I call to get current time in milliseconds (or great precision) to help measure how long a method took to execute? NSDate's timeIntervalSinceDate will return NSInterval which is measured in seconds. I am looking for something finer grained, something similar to Java's System.currentTimeMillis. Is there an equi...

iphone SDK: Not sure why I am not receiving UITextField events?

I have defined the controller to receive the events. @interface salesViewController : UIViewController <UITextFieldDelegate>{ However, none of my events are not firing. - (void)textFieldDidBeginEditing:(UITextField *)textField { //this is not getting called } In Interface Builder I assigned the TextField delegate to the s...

NSString stringWithString - what's the point?

As NSString strings are immutable, what is the value of the stringWithString: class method? Update - yeah, I get the utility when used with NSMutableString, I just didn't see the utility with the NSString class. Also - I apologize if I wasn't clear enough; I wasn't intending to startup the initWithString vs stringWithString thread. Than...

Getting thread id of current method call

Is there a way to print out the current thread id on which the current method is executing on? (objective-c please) ...

How can I store UIButtons in an array?

I have a method tied to four buttons. I want to create an array containing each button, and later retrieve and interact w/ a button from the array. The code I was tinkering with below. When I try to get a button from the array and send it a message, it goes kablooie. Any thoughts on what I'm doing wrong? Hack_DumpViewController.h ...

Tabcontroller problem?

Hi, How can i rotate tabbarcontroller in landscape mode when i am having XIB file(tab bar controller) in portait.i wrote the follwing in appdelegate (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return YES; } , but it wont be rotated any help please? ...

Trying to add some external code into project gives error

Hi to all, In my project I want to add Speak Here code which is a sample code given on developer.apple.com site. It contain some .cpp & openGLES code and files. t gives me syntax error. I tried to solve this problem by renaming the .cpp file to .mm still it have the same problem. My project is window based application in XCode by using ...

Pass a Layer object to an other class. How can i convert? Objective C

Hi, I have a .h file called LayerManagement.h, it defines a Layer variable: Layer *managelayer; I have a Layer class called HelloLayer, it defines: +(id) scene { Scene *scene = [Scene node]; HelloLayer *thislayer = [HelloLayer node]; man = [[ManageMove alloc] init]; > man.managelayer = thislayer;// can i do...

Non repeating Random Numbers.

Im using. for (int i = 1, i<100, i++) int i = arc4random() % array count; But im getting repeats everytime so how can i full out the chosen int value from the range so when the program loops i will not get any dupe? Thanks. ...

bottom up animation using Pushviewcontroller ?

hi, I am new to Iphone SDK.i am using following code.but the animation happens from Right to Left when i click this button.i want to do fro botton to Up - (IBAction)clickedsButton:(id)sender { [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuration:1.0]; [UIView setAnimationDuration:0.75]; [self.navigati...

How to play YouTube Movie on an iPhone Application when tapped on UITableViewCell?

I'm a newbie to iPhone development and just started on developing an application that contains a UITableView where each cell consisting of youtube video thumbnails in the form of webviews. For embedding YouTube Player on iPhone, I have used the follwing piece of code. - (void)embedYouTube:(NSString*)url frame:(CGRect)frame { NSString...

Method/IBAction stuck in infinite loop. Still no success.

Now this may sound like my earlier problem/question but I've changed and tried a few things that were answered in my other questions to try to make it work, but I've still got the same problem. I am observing a core data property from within a NSManagedObject sub-class and the method that gets called when the property changes calls anot...

how to play sound when alertview appears iphone sdk?

i want to play a sound file when alertview appears and plays continuously till user clicks on ok or cancel.how do i do this? ...

iPhone SDK: Accessing methods in other classes.

Hello, In my iPhone application I have multiple class files, I have my main application's class files, then I have my UIView class files. I have a simple -(void) method declared in my UIView class files, how can I access it from my main applications class files? A bit more detail: In my application a video is played, when this video fin...