objective-c

animation: make water wave

Hello there - I would like to build a simple animation for a school project. I want to make water wave within a box in such a way that tilting the device causes the water to wave in a direction rather the other. Is there a sample from where I can start to create such effect? Any help is super appreciated. Thx, mE ...

How can I make text in a UILabel non-centered?

I have a UILabel: descriptionLabel = [[UILabel alloc] initWithFrame:CGRectMake(200, 30, 130, 150)]; [descriptionLabel setFont:[Utils getSystemFontWithSize:14]]; [descriptionLabel setBackgroundColor:[UIColor clearColor]]; [descriptionLabel setTextColor:[UIColor whiteColor]]; descriptionLabel.numberOfLines = 0; des...

NSZombieEnabled hides EXC_BAD_ACCESS error entirely

So I have a subclass of a UIView that starts causing EXC_BAD_ACCESS errors when I go through a specific set of conditions (run on iPad instead of iPhone or simulator, first login only). It throws the exception when the UIView subclass gets autoreleased from the pool (i.e. the pool is releasing, not when I'm calling [view autorelease], du...

How to change an NSBox location (or position?) programmatically in objective c

I am learning objective c and am making some small programs. for my current project i am taking a NSBox and changing it's location based on a random number. How do I change the box's location? With C# it was a simple "box.location = anotherLocation" but I can't figure out how to do this in objective c. Any help would be greatly appreciat...

How can I make text in a UILabel shrink font size

If a UILabel contains too much text, how can I setup my label so that it shrinks font-sizes? Here is how I am setting up my UILabel: descriptionLabel = [[UILabel alloc] initWithFrame:CGRectMake(200, 30, 130, 150)]; [descriptionLabel setFont:[Utils getSystemFontWithSize:14]]; [descriptionLabel setBackgroundColor:[UIColor cl...

NSMutableArray does not print well with several lines of string

while(sqlite3_step(compiledStatement) == SQLITE_ROW) { NSString *araci2 = [NSString stringWithUTF8String:(char *)sqlite3_column_text(compiledStatement, 2)]; [dbarray addObject:araci2]; NSLog(@"DB ITEMS: %@",dbarray); } First of all, I try to get a description longer than a line from db. While part of the value appears meaning...

How to get NSFormatter subclass to work with NSTableColumn sort key and selector?

My setup: I have a sqlite database from which I populate a NSMutableArray of NSDictionary objects this is the DataSource for my NSTableView. One of the columns holds "time", the time is a float that holds seconds. I would like to display the values in this column as minutes:seconds. For instance my data would be 123.4329387 I want t...

Problem with CFRunLoopRun();

Hello, I have a problem I created this client connects to a server and then want to send and receive strings (this is not implemented yet). When creating the connection I have a problem since the creation of the connection does not do "CFRunLoopRun ();"( tested by degbug). Someone any idea? Thank you. - (void) acceptConnection:(int)fd {...

NSOpenGLView in NSSplitView

When i put an NSOpenglView in NSSplitView, a problem occurs while dragging splitter. The openGLView and SplitView are resizing asynchronously. i found a solution in apple mail list thread http://developer.apple.com/mac/library/samplecode/GLChildWindowDemo/Introduction/Intro.html and i found a solution with some carbon calls. but now i g...

iPhone Application crashing upon loading a new Detail View

Hi, My problem is when trying to load a detail view through a table cell, the application constantly crashes. The error that comes up when running through debug is "__TERMINATING_DUE_TO_UNCAUGHT_EXCEPTION___" objc exception thrown. If anyone can help me it would be greatly appreciated. Here is a screenshot for the debug, I am not sure ...

How to perform kCATransitionPush animation without any transparency / fade effects

I'm trying to duplicate the "slide up from the bottom" animation that [UIViewController presentModalViewController:animated:] performs but without calling it because I don't want a modal view. The below core animation code comes very close but appears to be changing transparency values of the views during it. At the start of the animati...

Can't Convert NSNamedColorSpace to NSDeviceRGBColorSpace?

Can anyone tell me why this colorUsingColorSpaceName is returning nil? For example, the following code block will print "deviceColor is nill": NSColor *color = [NSColor windowBackgroundColor]; NSColor *deviceColor = [color colorUsingColorSpaceName: NSDeviceRGBColorSpace]; if(deviceColor == nil) NSLog(@"deviceColor is nill"); How can I...

Determining whether or not a font can render a Unicode character in Cocoa Touch

Hi folks, I'm wondering if there's a way to determine whether or not a font supports a particular Unicode character in Cocoa Touch. Alternatively, is it possible to specify the default substitute character? ...

How to convert NSString* to ANTLR3_UINT8 or ANTLR3_UINT16

Could somebody tell me what is the proper way to convert a NSString* to an ANTLR3 string (used in C) ? EDIT: this seems to work char buf[255]; if ( YES == [myNSString getCString:buf maxLength:255 encoding:NSStringEncodingConversionAllowLossy] ) { pANTLR3_UINT8 theExpression = (pANTLR3_UINT8*)buf; ... ...

Emailing HTML from within an iPhone app is stopping at special characters

Hi, I have an iPhone app that will let users email some pre-determined text as HTML. I'm having a problem in that if the text contains special characters within the text (e.g., ampersand &, >, <), the NSString variable that I use for sending the body of the email gets truncated at the special character. I'm not sure how to fix this (...

Any way to ask a method for its name?

I'm trying to debug an iPhone app I'm working on, and the idea of adding fifty NSLog statements to the various source files gives me the willies. What I'd like to do is write a pair of statements, say NSString *methodName = [self methodName]; NSLog(@"%@", methodName); that I can just paste into each method I need to. Is there a way t...

Audio Tweets from Within an iPad App, Sending a Selected Recording from the App Sandbox

I'm updating a music app I have with the ability to share your .wav recordings via Twitter (this is somewhat similar to TweetMic). The app already has e-mail sharing and has functioning text-only tweet capability using the code from iCodeBlog's Twitter tutorial. Somehow, I can't figure out how to use something such as chir.ps or some o...

How to add my program to the OS X system menu bar?

I have created a volume controller for iTunes but I would like this app to place an icon on the OS X system menu bar and have my slider controller drop down. ...

ScriptingBridge causes iTunes to relaunch after quit

I'm working on a Cocoa app that monitors what you're listening to in iTunes, and since I'm targeting Mac OS 10.5 and higher, I've decided to use Scripting Bridge. If I try to close iTunes too close to the time that my app polls it for the current track, iTunes will immediately relaunch! The only way to reliably prevent this behavior is ...

Iphone Question: Multi-colored Textbox

Hello I'm stuck at this: How to implement a multi-colored textbox without using a WebView Obj? I want the textcolor updated in each key event and if I use a WebView The app will surely lag a little(touch 1g). I'm finishing up a app that teaches basic english, everything is up and running perfectly, but then I realized that a multi-color...