cocoa-touch

How to use Key Value Coding to Set Property Values in ABPerson

Given this key/value pair: FirstName = "Steve" I'd like to set the property of an ABPerson in the iPhone Address Book, like so: ABRecordSetValue(person, kABPersonFirstNameProperty, @"Steve", nil); The problem is, I won't always know what key is submitted. (It will be equivalent to a property constant without the "kABPerson" before it,...

NSPipe and System() - iPhone SDK Cocoa

Hello everyone, I need to add this section into my application where the user would enter in a terminal command for example "killall SpringBoard" and when the user presses the button it would run the command. I know that if you use the System("") function you can run the terminal command. But how about from a textbox? My next questio...

How to store the selected image in library to NSString

I want to get the complete url of selected image from photo library in iphone to NSString. Is it possible My code is NSString * filePath; UIImagePickerController * picker; picker = [[UIImagePickerController alloc] init]; picker.delegate = self; picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrar...

How to change rowHeight of a TableViewCell depending on Stringlength

I have a table with different entries, each with different length. The height of each row should fit, so it can show the whole string. I use the following code: //... cellForRowAtIndexPath if (row == 0) { cell = [tableView dequeueReusableCellWithIdentifier:@"affCell"]; //if (!cell) { cell = [[[UITableViewCell alloc] initW...

Core-plot Question : How to add a data Indicator

Hello Everybody, i want to add a data indicator line similar to the following image in core-plot. Any idea how i can achieve this using core-plot. I have just started to understand core-plot, so any tip will be very useful. Thanks Edit : For better understanding i have created a screencast to show what i mean : http://www.screen...

MoreViewController, edit, noneditable icon

I am using TabBar with more than 5 icons, co I get the MoreViewController as well and can edit icons in the TabBar. But I did not find the option how to forbid editing of one of the icons - similar to More. How can i fixate one icon? In the docu there is description of beginCustomizingItems, which if containing the item, will make it no...

Setting UITextField text within a loop?

Is it possible to set the text field for a UITextField for multiple objects from within a loop using setValue:forKey:? I am a little confused if I should be somehow specifying "text" in the property name, or if I am missing something else? // INTERFACE @property(nonatomic, retain) IBOutlet UITextField *textFieldBit_01; @property(nonatom...

iPhone: How to Get Basic Authentication to HTTPS Web Service Using NSURLCredential

I am trying to call an https web service (RESTful) using basic authentication. It works fine if I put the credentials in the url itself but I would rather add it to the request so that the password does not appear, for instance in an exception. I am using the following code: NSURLCredential *credential = [NSURLCredential credential...

iphone security data encryption

Hey. I would like to save sensitive user data to my apps sandbox but I know that if the phone is then stolen someone can "rip" (if thats the correct term) data off the device quite easily. So I need to use encryption. But I can't use standard private-public keys without either storing them in the code. (not good im assuming as if the b...

Using Cascade Delete Rule and validateForDelete on a One-to-Many Relationship in iPhone Core Data

Preface: I have two entities defined as a one-to-many relationship: A <<-------> B. B's relationship to A is called myAs and is a to-many relationship with Nullify as the Delete Rule. The inverse relationship from A to B is a to-one relationship with Cascade as the Delete Rule. I have implemented validateForDelete on the B class like s...

MSMutableArray, Adding / Removing objects?

Is this the correct way to pop objects off the front of an array. I was just curious as I was thinking there might be a method for NSMutableArray that returned a retained object. Just curious if I am getting this right? // PUTTING OBJECTS IN NSMutableArray *fgStore = [[NSMutableArray alloc] init]; for(int counter=1; counter<=5; counter+...

Converting [NSNetservice addresses] to ip address string

This question was already asked here: http://stackoverflow.com/questions/1720316/nsnetservice-ip-address and here: http://stackoverflow.com/questions/938521/iphone-bonjour-nsnetservice-ip-address-and-port I've used both of those to get where I'm at now. My problem is the following method I have doesn't quite work: - (NSString *)getSt...

Accessing the "selected" property of custom MKAnnotationView ?

I'm trying to use the "selected" property in MKAnnotationView ( discussed here ), this is for the user to be able to delete a selected annotation... The following piece of code should find the selected pin in MKMapView and remove it: CSMapAnnotation *a; for(a in [mapView annotations]) { if([a selected]) //Warning: 'CSMapAnnotatio...

From NSArray to UILabel

My code compiles fine but doesn't show the text from mathspractice.txt -(void)loadText { NSBundle *bundle = [NSBundle mainBundle]; NSString *textFilePath = [bundle pathForResource:@"mathspractice" ofType:@"txt"]; NSString *fileContents = [NSString stringWithContentsOfFile:textFilePath]; NSArray *mathsPracticeTextArray = [[NSArray al...

How to take an iPhone screenshot of entire view including parts off screen?

I have an application that's laid out using an UITableView. The interface takes up more than just the screen, so there's some area that can be scrolled to. I would like some screenshots of the entire view (including the non-visible area) to use for documentation and soliciting feedback from my customer. Is there programmatic way to get ...

Core data many-to-many relationship - Predicate question

In my Core Data model I have two entities: List and Patient. List has an attribute called 'name'. A List can have any number of Patients and each Patient can belong to any number of different lists. I have therefore set a relationship on List called 'patients' that has an inverse to-many relationship to Patient AND a relationship on Pat...

How to add a time interval to an NSDate

I have an NSDate and a duration. I need to get the time after the duration... Given: NSDate is 2010-02-24 12:30:00 -1000 duration is 3600 secs I need to get 2010-02-24 13:30:00 -1000 Actually I am looking for the time, but I think I know how to do that if I can get the NSDate object reflecting the new time. I thought dateWithTime...

Clean solution to know which MKAnnotation has been tapped?

Ok, so you typically have some object X you want to be annotated inside a MKMapView. You do this way: DDAnnotation *annotation = [[DDAnnotation alloc] initWithCoordinate: poi.geoLocation.coordinate title: @"My Annotation"]; [_mapView addAnnotation: annotation]; Then you create the annotation view inside - (MKAnnotationView *)mapView...

Good examples in open source iPhone applications.

Hi, I'm looking for good examples of open source iPhone applications. Not tutorials, but complete applications that made it to the appStore. So far the best I've seen is http://github.com/c99koder/lastfm-iphone - a LastFM client, a very well designed app, and I am curious if there are others like it. Any suggestions are welcome! Thank...

Reloading TTableView after DataSource items are added

Hi, This is the code of my initializer: if (self = [super init]) { self.title = @"Posts"; self.variableHeightRows = YES; //XLog(""); PostsDataSource *dataSource = [[[PostsDataSource alloc] init] autorelease]; [dataSource.delegates addObject:self]; [dataSource load:TTURLRequestCachePolicyMemory nextPage:NO]; ...