objective-c

Is UITableViewController compatible with NSCoding?

When I try to get a h file that inherits from UITableViewController to conform to NSCoding, I can't switch views. - (id) initWithCoder:(NSCoder*) coder { [self init]; return self; } Inserting the above code into the m file is what causes the problem. Why is that? ...

How to restore an array with NSCoder

So far I have the following: - (id)initWithCoder:(NSCoder*) coder { self = [super initWithCoder: coder]; if (self) { // Call a setup method } return self; } Am I supposed to put the code to load the array in here? What could should I put and where should I put it? ...

Should you use 'isEqual' or '==' ?

Hey. I saw a couple of questions here on SO, with ansers including the function isEqual: instead of the standard ==. So far, I have only learned to use the ==, so I'm wondering what's better to use, what are the pros and cons of each? When should you use them? Thank you. ...

How to get the duration of captured video using UIImagePickerViewController in Iphone sdk?

Hi Guy's I need to get the duration of video captured using UIImagePickerViewController Can any one tell me how could it possible to get the duration. Thanks in advance, Kiran. ...

How to autoplay next song in music application when first song completes playing

Hi to all, I have created a music application in iphone which have more than 50 songs.When i want to play the song i need to click on the song and then play after that when i want to hear the next song in series i need to click on the song and play. i want that when i play a particular song and after that song completes playing the next ...

Etags: generate tag for Objective-C methods declaration

How to make etags generate tags for both the declaration (i.e. inside the @interface block) and the definition (i.e. inside the @implementation block)? The default behavior is only to generate tags for the definition. I've already tried to invoke etags with --declarations but that didn't solve the issue. A way would be to pass a custom ...

Regular class global variable being shared between object instances - help!

So I have just started learning objective c having a little Java experience and this site has been really helpful for answering loads of my questions, but I've hit an issue I can't quite fathom. Theres a fair amount to be read on the topic but I can't quite find where I've gone wrong. So I read this: Objective C does not support cl...

When does encodeWithCoder get called?

This will save an array (I think). - (void)encodeWithCoder:(NSCoder *)encoder { [encoder encodeObject:myArray forKey:@"myArray"]; } Do I have to directly call this method when I want to save an array or do I have to do something else? ...

When does initWithCoder get called?

This will load an array - (id)initWithCoder:(NSCoder*) coder { self = [super initWithCoder: coder]; if (self) { myArray=[coder decodeObjectForKey:@"myArray"]; } return self; } What is the code that will call this function so that the array can be loaded? ...

Does this write or read an array?

[[NSUserDefaults standardUserDefaults] setObject:myArray forKey:@"myArray"]; I'm trying to figure out how to save and load an array using NSUser Defaults. I already have the NSCoding delegate methods defined, just need to know the actual commands to execute that will call those methods. ...

Get UILabel out of UIButton

I have an UIButton to which an UILabel was added as a subview. Is there an easy way to get the UILabel back out of it so I can change it's title ? ...

Tutorial for saving an array of custom objects

Is there a tutorial for saving and restoring an array of custom objects? ...

How to get a main (window?) UIView in iOS?

I'm developing a PhoneGap app, extending it with native stuff. I can make an UIView like this: [[UIView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]] and show some stuff like ActionSheets here. But the MBProgressHUD doesn't show up in this view. So how do I get the main view (or the PhoneGap's WebView)? ...

How to click a checkbox in nstableview and update an object using KVC?

Hi all. I am trying to learn cocoa and have a few problems with KVC and bindings. I have a nstableview with three columns; "checkbox", "text", "icon". The values of each column is binded to an arraycontroller using KVC. When program is launched the rows and columns are correctly filled into the tableview according to the values in the ...

NSString in webview iPhone and objective-C

Hi, i have an NSString and a webView in my project (Objective-C for iPhone), i have called index.html in webView and in index.html i have written my script (javascript) How can i pass the NSString as a var in my script and viceversa? http://developer.apple.com/library/safari/#documentation/AppleApplications/Conceptual/SafariJSProgTopics/...

ASIHTTPRequest Error

(void)getFacebookProfile { NSString *urlString = [NSString stringWithFormat:@"https://graph.facebook.com/me?access_token=%@", [_accessToken stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]; NSURL *url = [NSURL URLWithString:urlString]; ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url]; [request setDidFinishSe...

coder encodeObject

Consider the following code [coder encodeObject: properties forKey:@"properties"]; Are there any restrictions on what kind of object is passed as an argument to encodeObject? Can it be an object from a custom class? ...

Xcode - Is there a way to get the extension of a resource?

Hey all, this should be pretty simple to answer: Is there a property of a NSURL such as lastPathComponent and StringByDeletingPathExtension that actually gives you just the extension instead? If so, what is it? Thanks! ...

ASIHTTPRequest Unable to create request (bad url?) Error

I keep getting: Unable to create request (bad url?) error message on a request like: - (void)grabURLInBackground :(id)sender { NSURL *url= [NSURL URLWithString:@"http://api.website.com/api_requests/standard_request/getItemRequest={\"Id\":\"Logic\"}"]; ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url]; [request ...

iPhone/iPad SimpleTableViewCells: What replaces the deprecated setImage setText on table cells?

iPhone/iPad SimpleTableViewCells: What replaces the deprecated setImage setText on table cells? The below code gives warnings that setImage and setText are deprecated. So what replaced them? What is the new better way to get this simple behavior? static NSString *SimpleTableIdentifier = @"SimpleTableIdentifier"; UITableViewCell *cel...