objective-c

displaying different views based on a condition checked in view controller

I want my view controller to display different views based on a condition that depends on some runtime checks (lets say a uiwebview at even hours and a form on odd hours). What is the best pattern to achieve it in iphone project? Maybe I can hide controls based on aforementioned condition or maybe it is better to load different views? or...

Box2d:apply velocity in a direction

Hi, I apply impulse in an object in box2d iPhone app and now want to increase its speed in particuler direction....i mean i need two thing 1.through the object in a direction 2.increase speed plz help.. ...

Need a UIButton to tell me continuously whether or not it is touched

Hello, There's probably something really obvious I'm missing, but no matter how I trawl the documentation & the blogs, I can't find a way to make a button report whether or not it is being touched, regardless of whether the touch moves, etc. I have an up & down button, & I need to call the relevant method whenever there is a finger on ...

How does - (CGRect)convertRect:(CGRect)rect toView:(UIView *)view work.

I've been using that kind of methods on and off but never really understood how they behaved. Every time I try to use them, I find myself poking in the dark as I try different aspect and it never seem to do what I expect it to. For the sake of argument, I'm trying to convert the frame I get from UIKeyboard's notification. In landscape...

XCode 4 Error about missing documentation from doxygen.app / Core-Plot

I recently upgraded to XCode 4. I imported a project from 3.2 and started a build. I got two errors immediately, regarding missing documentation. The project built successfully regardless, but I'd like to remedy the issue. I compile with the core-plot framework, and the error is specific to some missing files in doxygen.app. After s...

UIImageView animations lag at first run

I have a series of images that play in my application (it's only got one view/viewcontroller). Whenever I run the app, the first time I play an animation, it will lag a bit the first time the animation is told to play. I run my animations via different methods (e.g. "animateJump") which are responsible for loading the correct frames, th...

cocoa : dock like window

Hello, I am looking to create a NSWindow behaving like the dock window: - Appears when the mouse cursor stays at one edge of the screen - Does not takes the focus (the app having the focus keeps it) but reveives mouse events Any idea on how I can implement this? Thanks in advance for your help, ...

XCode 4: How do you add an existing framework?

I know in previous version, you could right-click and go to Add > Existing Framework. I can't find a similar option in XCode 4. ...

[iphone] empty string, textfield

hi, if i want to check whether a textfield or string is empty i compare it with NULL or nil? thks ...

Record Sound in Cocoa Example Please!

Hi, I've been scouring both this site and the net in general for an example cocoa app that uses QTKit or Audio Queue and actually works. Unfortunately, I can't find anything that fits the above description. All I want to do is get a simple audio recording app so I can learn how it works! Please, I have put alot of time into this alre...

Help Sorting NSArray

In my project I roll through a bunch of sql records and populate a NSMutableDictionary with a string for each key. The keys are important because I use them as section titles in my TableView. The problem I have is that I would like the sections in a certain order. When I call allKeys the order of the keys isn't the same as the order the...

C++ and Objective-C Combination

Hi, I need to know whether I can write the whole class in C++ and use it in XCode using Objective-C? I need to write a code to query HTML using POST method and I think the best approach is to use either C++ or C#. Umair ...

How do I detect an iPad's interfaceRotation at the start?

Hi, I'm having problems getting my iPad app to detect its interfaceOrientation in the first UIViewController I initialize (in code). In fact, if I trace for application.statusBarOrientation, that too returns 1 (UIInterfaceOrientationPortrait) even if I launched in landscape. If I trace self.interfaceOrientation in my first UIViewContro...

RTFString Containing NSASCIIStringEncoding Special Characters?

I have a string in my cocoa GUI that needs to have special formatting (fonts, colors, etc.). Naturally, I'm using an attributed string. For convenience, I Init the string as an RTF: NSString *inputString = @"This string has special characters"; NSString *rtfString = [NSString stringWithFormat:@"{@"***LENGTHY RTF FORMATTING STRING *** %@...

navigation will terminate?

Hi, does anyone knows how can i can call a notification similar to - (void)applicationWillTerminate:(NSNotification *)notification which is when app terminate, but what i want is when i drill up a navigation view. thks in advance. ...

How does "bump" technology work?

Any good documentation or articles out there about doing device-to-device data transfer? ...

applicationDidFinishLauching never invoked, WillFinishLauching does

I have a Cocoa application which works fine except it will not invoke applicationDidFinishLauching on my app delegate. applicationWillFinishLauching does work though. In IB I have set the delegate from "Application" (and also File's owner) to my "XXX App Delegate" object. All other application specific methods are called correctly weird...

ModalView rotation with a thick border (like iBooks app)

controller.modalTransitionStyle = UIViewAnimationTransitionFlipFromLeft; [self presentModalViewController:controller animated:YES]; Is there any way to make it flipping with a thick border/side? (like iBooks app, when you're switching between books view and the books store) ...

@selector in objective-c not behaving as expected

Hi all, I am a little perplexed and I have been working on this for hours and googling without any real leads. I want to create a callback in objective-c for my iPhone app utilizing the @selector. Class 1: - (void) someMethod { // create selector SEL successCallback = @selector(successMethod); // call some service with c...

AVAudioPlayerdelegate

Hello, I receive this error for this code- warning: class 'BeatMaker' does not implement the 'AVAudioPlayerDelegate' protocol -(IBAction)playBeat3 { NSString *path = [[NSBundle mainBundle] pathForResource:@"beat3" ofType:@"mp3"]; AVAudioPlayer* theAudio=[[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:path] ...