objective-c

Calculating number of seconds between two points in time, in Cocoa, even when system clock has changed mid-way.

I'm writing a Cocoa OS X (Leopard 10.5+) end-user program that's using timestamps to calculate statistics for how long something is being displayed on the screen. Time is calculated periodically while the program runs using a repeating NSTimer. [NSDate date] is used to capture timestamps, Start and Finish. Calculating the difference b...

Resize view of NSCollectionViewItem

How do I programatically set the size of a view of an NSCollectionViewItem? I tried doing this in an NSCollectionView subclass: @implementation CustomCollectionView - (NSCollectionViewItem *)newItemForRepresentedObject:(id)object { NSCollectionViewItem *newitem = [[self itemPrototype] copy]; [newitem setRepresentedObject:obje...

How to find out whether the iPhone / iPod Phone can be used?

Hi all, what is the best way to find out whether the current device supports a phone call? iPod Touch does not support it at all and iPhone does only support calls after entering the SIM password. Is there a similar method like [MFMailComposeViewController canSendMail] for mail? Thx in advance :) ...

Is there a way to change color of just part of a string inside a UILabel?

Say I wanted to have the first six characters in black and the next six characters in blue, then the last 20 characters in black of a UILabel. Is this possible? Thanks! ...

Which methods and class will Safari call when it's launched?

I want to class-dump methods and class of safari launching for get the DOM OBJECT in the webpage. But I didn't know which methods and class will be called when it launch ? Thank you very much ! ...

CGAffineTransformMake - how to save the state of UIimageview to futher process it

I am using CGAffineTransformMake to flip an UIImageView vertically. It works fine but it does not seem to save the new flipped position of UIImageview, because when I try to flip it 2nd time (execute the line code below) it just does not work. shape.transform = CGAffineTransformMake(1, 0, 0, 1, 0, 0); help please. Thanks in advance. ...

NSImage imageNamed: for Mac Mini returns small icon instead of high-res

When using NSImage's imageNamed: method to get the icon for the current computer, if I'm running on a Mac Mini, then I get a low resolution image. If I run the same code from my MacBook, then I get a high-res icon like I'd expect. My code is as follows: NSImage *image; image = [NSImage imageNamed:@"NSComputer"]; [image setSize: NSMakeS...

Creating a simple Simon clone: How to wait between updates?

I'm learning Cocoa/Objective-C/iPhone SDK, and as a simple project to apply what I've learned, I wanted to create a simple version of the Simon game of old. Four colored buttons, you're shown a sequence (Red, Green, Blue, Red, etc.) and you have to repeat the sequence back. I believe I have most of it figured out, save one piece: showi...

HMAC - Implementation of PHP algorithm in Objective-C

Hi, I have to implement the HMAC MD5 in my iPhone app. The PHP version of the algorithm (implemented server side for verification) is here and I can't modify it (it's an API) function hmac($key, $data) { $b = 64; // byte length for md5 if (strlen($key) > $b) { $key = pack("H*",md5($key)); } $key = str_pad($key, $b, chr(0x00)); ...

Handling CoreLocation service reply

Hi, In my app i am using CoreLocation services to access current Location. For accessing the current location in iPhone the Location service must be turned ON in settings. If not it alerts the user as "Turn On Location Services to Allow "helloworldApp" to determine Your Location" and choices for this alert message are settings and can...

Building for Mac OS 10.6 results in error "In [..]/libZonicKRM.a, missing required architecture x86_64 in file"

I'm updating application for Mac OS X 10.6 and getting this error. I believe that means Kagi/Zonic KRM module doesn't support 64-bit? So I can't build my app as 64-bit, right? Is there anyone who use Zonic KRM under Snow Leopard?.. ...

SQLite on iPhone - Get final query string with parameters after binding

I would like to get the final SQL query, with parameter values bound (replaced) for debugging. It is a rather large and complex query (some joins, and about 20 parameters). Just wondered if it was possible to access the final query passed to the sqlite db. //PSEUDO CODE theSQL = "SELECT a,b,c FROM myTable where aField = ?"; sqlite3_pre...

NSXMLParser foundCharacters method!?

Hey! i'm using the NSXMLParser to fetch a String from xml. I'v created a class to store the data with synchronized variables. To get the text between the elementName i use the foundCharacter function. And to store the Strings i use a MutableString *. When i find the String and print everything is correct but when i'm done the two differ...

Getting the selectedIndex of the currently selected tab from a viewcontroller

I currently have an iPhone application with a tabbar and multiple viewcontrollers. All the views are designed in Interface Builder. I'd like to be able to get the currently selected index of the tabbar from the viewcontroller, but for some reason this property returns (null). I called the following in the viewDidLoad function of my view...

how to prevent uilabel text from shrinking?

i am showing digits on uilabel and using timer to update text something like counting down.. i am using this font to show time like lcd clock [CountdownLabel setFont:[UIFont fontWithName:@"DBLCDTempBlack" size:48.0]]; i am facing two problems in this. using this font the dots(:) between the digits is smaller than the digits. the dig...

Objective c library with c interface

Hi everyone, I have run into a problem... I'm trying to use QTKit in an application that we have at work. The only problem with that is the app is written in C++, not Obj-C. I have looked through Apple's documentation for answers, but I haven't found anything useful. Basically what I'm looking to do is write a single controller class i...

Parsing a .txt or html file into a string in the iPhone SDK

So, what I'm trying to do, is take a .txt or html file, being able to search through it, and grab a piece of text from file, place it into a string and finally adding it into a textView. Each couple of piece of text will be divided like this: 001:001 Text1 001:002 Text2 001:003 Text3 002:001 Text1a 002:002 Text1b...

iPhone Image slideshow

Hello, I want to create a slideshow on iphone. I don't know if there is already a sample code or a lib that already do that. Thanks for your help ...

Is there a way to dynamically determine ivars of a class at runtime in Cocoa / Cocoa Touch?

Is there a way to obtain something like a dictionary of all key-value pairs of a class? ...

Zipping Things Using Objective-C

Hello, I'm learning Objective-C using GNUstep(because I use Linux). I was thinking in create a simple zipper application only to practice, but how where i can find a tutorial to build it? and which is the common library used to this things in Objective-C? Thanks. ...