cocoa-touch

Simplest way to loop between two NSDates on iPhone?

What's the simplest way to loop from one date to another? What I want conceptually is something like this: for (NSDate *date = [[startDate copy] autorelease]; [date compare: endDate] < 0; date = [date dateByAddingDays: 1]) { // do stuff here } This doesn't work, of course: there's no dateByAddingDays:. And even if it did, it...

compile problem for xcode 3.2

Hey I have problem compiling code in xcode 3.2 I have a code where it's using iOS 4's API, "MFMessageComposeViewController" It would compile fine with 4.0 under xcode, but when when i try to compile with 3.2 I get error because of "MFMessageComposeViewController". It seems that xcode can't find keyword for MFMessageComposeViewController....

Iphone - begginer questions - retain data member and Notifications

Hi, Just need 2 really basic clarifications. 1. Lets say I have a class A which has a member delcared like: @property (nonatomic,retain) NSString* stringInstanceVariable ; In one of my methods, I want to initialize stringInstanceVariable to be some string. Do I need to retain it or not ? should I call: stringInstanceVariable = [[NS...

How can I escape slashes and quotes in Objective-C?

I would like to do the following [controller setMessageBody:[NSString stringWithFormat:@"<strong>%@</strong> <br> <br> %@ <br><br> %@ <br><br> Sent From MyApp",self.articleTitle, self.articleDescription, self.articleURL] isHTML:YES]; on the last %@ I would like to do <a href="%@">Hello</a> But I am not sure how to escape it properly...

iPhone Crash Log: Failed to Resume in Time

I am looking at my crash logs and noticed "failed to resume in time" Application Specific Information: com.myApp.MyApp failed to resume in time elapsed total CPU time (seconds): 0.680 (user 0.350, system 0.330), 7% CPU elapsed application CPU time (seconds): 0.130, 1% CPU How can I resume in time? ...

Draw a transparent box on the iPhone

How do you make a transparent box like the one for the PDF viewer that shows the page number? ...

Custom UITableViewCellEditingStyle.

Is it possible to create a custom UITableViewCellEditingStyle, say to change the the image/icon that appears next to each row and maybe what action it takes. Is it possible and if so how? ...

What do we mean by an Object "sending messages" and how do protocols help an object advertise the messages it supports?

What do we mean by an Object "sending messages" and how do protocols help an object to advertise the messages it supports? Does anyone have an example? ...

Populate iphone tableview from an SQLite database

Hello, I am trying to populate an iphone table view with values from an SQLite database. Lets say the table is as follows: Name      description     picture poodle    likes to growl      poodle.jpg cat          likes to meow     cat.jpg ...                   ...                   ... How would I ...

initializer element is not constant error when initializing an object from custom class

i am following along(mostly, im playing around with different functionality) with sams teach yourself cocoa touch programming and im building a calculator but when i try to initialize an object of the calculatormodel class i get this error: " error: initializer element is not constant". can anyone explain this or give me a solution? tha...

UITableViewCell with image background, ignoring touches?

Hi have setup a UITableViewCell from a nib file and everything is working as expected. However I decided it would be nice to add a UIImageView as a background to make the cell a bit more interesting, the only problem is that the new UIImageView is now stopping touches getting to the underlying UITableViewCell (i.e. the cells do not turn ...

UITableView, Separator color where to set?

I have added a UITableView in IB and set the delegate and datasource and all is working well. What I wanted to do next was change the separator color, but the only way I could find to do this was to add the method to one of the delegate callbacks, is there a better place I should put this? I don't have this at the moment but I was think...

How can I tell my app is about to become inactive/go to background state?

I am assuming I need to implement: [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(resignActive:) name:UIApplicationWillResignActiveNotification object:nil]; ...

UITableViewCell strange width?

I have setup a UITableView (320 wide) with a UITableViewCell created in IB, the cell is also 320 wide. After setting a background image (320 wide) in UITableViewCell (or my subclass to be correct) I have noticed that the cells fall short of the right hand side of the UI (notice the blue on the selected cell and the grey on the one above)...

call methods from web page

I am using UIWebView in my application. I would like to have some hyperlinks to call methods in the Objective-C app. Is it possible? How? ...

NSFetchedResultsController.sortDescriptor by KeyPath

Hi, How can I set my fetchedResultsController.sortDescriptors to contain a sortdescriptor that uses a keypath, for instance, such as @"foo.name"? Cheers Nik ...

Is it possible to combine the settings bundle and main application localisation resources?

In the documentation for localising settings bundles, here, it seems to imply that the strings in the user defaults are only localised using the .strings files within the settings bundle. Is it possible to combine these .strings files with the main application's localisation resources so that all translations are in a single location ra...

How to remove shadow in subviews when using shadow properties of CALayer

I enabled shadow in my view as in the following: UIView *contentView = ...; contentView.layer.shadowOffset = CGSizeMake(0, 0); contentView.layer.shadowRadius = 5; contentView.layer.shadowOpacity = 0.8; However, subviews that add to contentView are also displayed with a shadow which is not what I want. I only need the superview ("conte...

fileExistsAtPath: (NSFileManager)

Is this method supposed to take a path as its argument? It looks like it takes a filename as a path: For example, /home/file.txt is a file, while /home/ is a path. This method looks like it takes the former as an argument. ...

UIView drawRect vs initWithFrame

I have a UIView which has several buttons added to it as subviews. Currently I have the buttons in drawRect:, which I have heard is a bad idea because drawRect can be called several times. I tried to move these UIButtons to initWithFrame, but they just don't get drawn. How should I fix this? I am not using interface builder, so there ar...