objective-c

Simple UITextView crashing

I'm trying to use a simple UITextView in a basic view, but it causes the app to crash sporadically. Sometimes it crashes while I'm typing something in it, sometimes when I'm scrolling, sometimes after I hit the return key. From the stack trace, it looks like it's being caused by graphics or animation related code for rendering UI element...

Objective-C String Differences

What's the difference between NSString *myString = @"Johnny Appleseed" versus NSString *myString = [NSString stringWithString: @"Johnny Appleseed"]? Where's a good case to use either one? ...

Exception while reading an empty table

Iam trying to read data from a table. Initially it is empty. If i tried to read at that time it will cause an exception. My code is given Below -(NSMutableArray *) selectDataFrom:(NSString *) tableName { NSString *qsql = [NSString stringWithFormat:@"SELECT * FROM '%@' ",tableName]; sqlite3_stmt *statement; if (sqlite3_p...

Error -fnested-function while compiling

Hey there, I saw some documentation and previous questions about this, but couln't find a solution. My code looks like: for(NSString str : NSArray){ NSLog(str); } The error is at the : Thanks in advance. ...

Is there an objective-c/iPhone version of currentTimeMillis() from Java?

I need to time some events in the app I'm working on. In Java i used to be able to call currentTimeMillis() but there doesnt seem to be a version in Objective-c. Is there a way to check there current time without creating a NSDate and then parsing this object everytime i need this information? Thanks -Code ...

What is the result of "nil%2" in objective-c ?

Hi, What is the answer to "nil%2" in objective-c? I think the answer is 0 but I am not sure. Thank you. ...

Error building my app to my ipod touch:building with 'Targeted Device Family' set to iPhone only ('1') not supported with SDK 'Device - iPhone OS 3.2

So I finished coding my app, and downloaded the development profile n all that good stuff with the entitlements, etc; but I get these warnings: ld: warning: in /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.0.sdk/System/Library/Frameworks/CoreGraphics.framework/CoreGraphics, file was built for i386 which i...

iPhone custom navigation bar with button doesnt click

Ive got an iPhone/iPad universal application and I wanted to have a custom navigation bar where the top half of the nav bar contained our companies logos, and the bottom half was the standard navigation bar. I figured out how to do this, showing in the code below, but my UIButton "logosButton" doesnt always respond to being clicked, it ...

NSScrollView gives error when scrolling "-[CALayer isEqual:]: message sent to deallocated instance"

Hello. I'm trying to fix my code but I have no idea why I'm getting these errors: modifying layer that is being finalized - 0x11818240 2010-09-10 02:35:53.022 iPhone Monkey Curling[1606:207] modifying layer that is being finalized - 0x11818240 2010-09-10 02:35:53.023 iPhone Monkey Curling[1606:207] modifying layer that is being finalize...

ffmpeg for extract a frame from iPhone video camera

I am trying to extract an image frame from a video taken from iPhone camera using ffmpeg. But it usually throws me a EXEC_BAD_ACCESS and the stacktrace is showing in another method calls that is never called (I know my code didn't call it) I am using the ffmpeg built from the instruction of the iFrameExtractor website. If anybody do it ...

UITableView calling UITableCell causing undesired output

Hi, I'm trying to toggle the color of UITableCell when it is clicked. Code is below - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { RowCell *cell = (RowCell*) [tableView cellForRowAtIndexPath:indexPath]; [cell toggle]; } The toggle actually works, except that it seems like it hili...

Clojure's protocols influences?

Was Clojure influences by ObjectiveC Protocols? If no then how are they difference? ...

How can I use this NSPasteboard code for v10.5 or earlier?

Hi, I'm trying to to paste something to the generalPasteboard but I keep getting some warnings because I'm using 10.6 coding in my 10.5 app. Can someone please fix this code to make it compile for 10.5 or earlier versions of OS X. Thanks NSString *areacode = @"774"; NSPasteboard *pasteboard = [NSPasteboard generalPasteboard]; [...

Core Data Lightweight Migration - Cant Merge Models

Hi Guys, I need to add some attributes to my core data model and I am having a terrible time getting lightweight migration to work! I keep getting the error "Cant merge models with two different entities named blah". Here's what I've done ... Added this code to my app delegate. (NSPersistentStoreCoordinator*)persistentStoreCoordin...

Selecting a row in a UIPickerView dynamically

Hello everyone ^.^, I have an iPhone app that use UIPickerView and 3 buttons. This picker has one component with 100 rows (0, 1, 2, ..., 98, 99). I'd like to implement the code so that, when I press on the buttons button1: will make the picker select row 21th (which has value 20) button2: will make the picker select row 41th (which ...

NSNumberFormatter question

I'm trying to save a float like so [NSNumber numberWithFloat:[dosage floatValue]]; and read the value like so: dosage = [NSString stringWithFormat:@"%1.0f", [prop.dosage floatValue]]; The Problem is that numbers like 0.11 end up being 0 I've read that I can use NSNumberFormatter, but the docs are not very clear on how to set it fo...

Packing ints to bytes (NSData)

I want to pack a MIDI message into an NSData object. int messageType = 3; // 0-15 int channel = 5; // 0-15 int data1 = 56; // 0-127 int data2 = 78; // 0-127 int packed = data2; packed += data1 * 127; packed += channel * 16129; // 127^2 packed += messageType * 258064; // 127^2 * 16 NSLog(@"packed %d", packed); NSData ...

How to do comparison Check through multiple NSString with objects

Hi, I am having difficulties with some logic. What I am trying to do is I have a nsmutablearray which I want to do a check with an object. If i have selected multiple creditcards in a particular view i store that card details name is my nsmutablearray called filteredCard. Then I have objects of companies which has one or more creditcard...

How to disable "delete" when the table section is 0 on iPhone?

I have a UITableView with two sections, and I added a edit button. If I press the edit button, I can delete the item on the UITableView, but I wanna to check the if the section is 0, the delete button will not display, how can I handle it for that purpose? Thank you. ...

NSScrollView clipping overlaid UI elements

I have a button that sits on top of an NSScrollView, not within. When the scrollview scrolls, the button get's clipped with part of the button going along with the scrolling and the other part staying positioned. To better describe the issue here's a video of the issue: http://dl.dropbox.com/u/170068/ScrollTest.mov The planned goal wa...