objective-c

Why isn't my sheet attached to the window it's run for?

I have a NIB which contains two windows, one is the app's main window visible at launch and the other is a custom sheet (and therefore not visible at launch). When the sheet is required my controller calls: [NSApp beginSheet: sheetWindow modalForWindow: mainWindow modalDelegate: self didEndSelector: @selector(didEndSheet:returnCode:cont...

Does [NSMutableDictionary setValue: value forKey: key] retain NSString key?

When adding items to NSMutableDictionary using the setValue:forKey: method (I suppose this generalizes to any NSObject) does the dictionary retain the second parameter, the NSString? For example: NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; NSMutableDictionary *dict = [[NSMutableDictionary alloc] init]; NSString *theStri...

iPhone memory management question (adding a subview to a view in a for statement)

I need to add more views to a view for handling multiple webaddress and the clicks on the labels. I try to do it in a for statement. My code is something like that: // we have a UITabbarViewController for holding amongs other the parentViewController UITabBarController *tabbedViewController = [[UITabBarController alloc] init]; // creat...

Synchronizing UIScrollView scrolling

I have three UIScrollViews, scrollView1, scrollView2, and scrollView3. When scrollView1 is scrolled then scrollView2 should scroll horizontally with it, and when scrollView3 is scrolled then scrollView2 should scroll vertically with it. How can I do this? ...

How to extract the attachments from an IMAP message?

Hi, how do I extract all attachments from an IMAP message? I use Objective-C and Cocoa, but are happy for generic tutorials, code or hints, too. Regards ...

need a 24 bits type in objc

Hello, I need to a variable which holds a 24 bits value, what should I use ? Also, do you know a list of all available types in Objc? Thanks a lot. ...

Custom colors in UITabBar

Is it possible to use custom colors and background images in a UITabBar? I realize that Apple would like everyone to use the same blue and gray tab bars, but is there any way to customize this? Second, even I were to create my own TabBar-like view controller, along with custom images, would this violate Apple's Human Interface Guidelin...

How to prevent the OS X text layout engine from automatically "flipping" lines with right-to-left text?

How do I make Apple's Cocoa GUI controls not automatically "flip" lines that contain right-to-left text (such as arabic)? Behold my test case, wherein I plan to keep the asterisks (**) in the beginning of the lines when they are printed on screen: #import <Foundation/Foundation.h> int main(int argc, char *argv[]) { NSAutoreleasePo...

CoreAudio AudioTimeStamp.mHostTime clock frequency?

I'm running into a bit of a problem with AudioTimeStamps on the iPhone. When I'm running my application in the simulator the AudioTimeStamp.mHostTime appears to be in nanoseconds (1,000,000,000th of a second) whereas when running on my device (iPod Touch 2G) the frequency appears to be about 6,000,000th of a second. It appears that on O...

What does the 'k' prefix indicate in Apple's APIs?

I've run across many examples of Core Foundation variables named k + someVariableNameHere or k + APILibraryName(2Char) + someVariableNameHere. What does this prefix K indicate? Examples include: kGLPFAStereo kCollectionLockBit kSetDebugOption ...

Object retain behavior of Objective-C class methods

What's the best practice for retaining and releasing objects passed to class methods? For instance, if you have a "class variable" declared like so: static NSString *_myString = nil ...is the right thing to do this: + (void)myClassMethod:(NSString *)param { _myString = param; } ... which has the drawback that the caller needs ...

Photo Library view stays on screen after choosing an image with UIImagePickerController

After I choose a picture through the UIImagePickerController interface from the Photo Library, the Photo Library view stays displayed, even though I've called dismissModelViewControllerAnimated in imagePickerController:didFinishPickingImage:editingInfo. Has anyone seen this? These are the three relevant methods I'm using: - (IBAction)c...

Play 1 sound clip after another without any interruption in iPhone !

Hi, I am developing a simple iPhone sound app. How can I play 1 sound clip after another without any interruption ? ...

iPhone UIDatePicker style

is there any way/trick to change the size, font, background color etc. of a uiDatePicker?? even the backgroundcolor attribute does not work and the default style of the picker is sooo irrelevant with the design of my application :( ...

What causes fluctuating execution times when presenting the Renderbuffer? (OpenGL)

This is what happens: The drawGL function is called at the exact end of the frame thanks to a usleep, as suggested. This already maintains a steady framerate. The actual presentation of the renderbuffer takes place with drawGL(). Measuring the time it takes to do this, gives me fluctuating execution times, resulting in a stutter in m...

How can I programmatically get the MAC address of an iphone

Does anyone know how to programmatically get an iPhone's MAC address and IP address? ...

Link error with Cocotron

I've recently built a linux platform interface for Cocotron, and was able to build the Foundation framework with no errors. However, when linking my objective-C project, I get a linker error: /Developer/Cocotron/1.0/Linux/i386/Frameworks/Foundation.framework//libFoundation.so: undefined reference to `__gnu_objc_personality_v0' I've do...

Get current location using Wi-Fi?

How to get current location using Wi-Fi towers in iPhone without using GPS? Actually I have an old iPhone which does not contain any GPS. So I want to find my current location using Wi-Fi or by using any other method. ...

What's the best way to implement a Java-like ByteBuffer in Obj-C?

I'm trying to build a application for the iPhone, although I am completely new to Obj-C. For one problem I'd use a ByteBuffer in Java, but I don't see any appropriate class in Apple's documentation. So I probably have to implement it on my own. My question is, how to do it best: Is there a similar class in Obj-C? (That would be the be...

Boolean logic failure

I am having a strange problem with boolean logic. I must be doing something daft, but I can't figure it out. In the below code firstMeasure.isInvisibleArea is true and measureBuffer1 is nil. Even though test1 is evaluating to NO for some reason it is still dropping into my if statement. It works ok if I use the commented out line. Any id...