objective-c

How to remove excess blank space in between the tags and extract only the content in xml parsing in iphone?

I am new to iphone Development.I want to remove excess blank space in between the tags and extract only the content in xml parsing.My XML file is like <entry> <title>This is sample test</title> <published>xxxxxxxx</published> <summary> This is summary </summary> </entry>...

How to detect and handle HTTP error codes in UIWebView?

I want to inform user when HTTP error 404 etc is received. How can I detect that? I've already tried to implement - (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error but it is not called when I receive 404 error. ...

How to set a object to an interface in Objective-C?

Hi, I want to know how to create an object to an interface ie @protocol in Objective-C? ...

Compiling a C library so it can be used in an iPhone static library

I've never done this before, so I'm not sure where to even start. I have a few projects where I want to use the liblio library, both on the iPhone and OS X. I've put the installation instructions in a gist. Here are my questions, and I'll try and edit these questions as I figure them out. Do I want to use make install to compile these...

In Cocoa, what is the purpose of the main.m class?

It just sits there... How do I run code independently of UI actions (as in, not only in response to a button push)? I'm trying to initialize some objects and run some scripts BEFORE i awakeFromNib. How do I do this? ...

what is this error message complaining about? and how to resolve it?

try to apply a patch and compile received warning message: <some_file>: In function '-[XXXXX saveAndCreate:]': <some_file>:262: warning: 'NSString' may not respond to '-stringByReplacingOccurrencesOfString:withString:' <some_file>:262: warning: (Messages without a matching method signature <some_file>:262: warning: will be assumed to re...

Why doesn't NSOperationQueue execute when declared in a UIView

When I declare a NSOperationQueue member in a UIView subclass, operations send to it won't execute. When the queue is declared in the AppDelegate however the same operations are executed. Any ideas? [EDIT] Ah, fixed it. Problem was my queue initialization was in the initWithFrame, which isn't called when it wakes from a nib. So annoyin...

Hiding UITabBar when displaying UIPickerView in iPhone SDK

I've got a view when I want to use UIPickerView but my application supports also UITabBar. I want to display UIPickerView in the same spot where keyboard pops up but the problem is that when I do that tab bar buttons are above picker and only half of it is beign displayed. Is is possible to temporary disable tab bar before I draw a picke...

Cocoa/Objective-C : Best Practice to parse XML Document?

I never worked with XML in Cocoa before so I have no idea where to begin. Right now I need to parse a XML File (from Hard disc) into an object or even an Array of objects. My XML looks like this <Person> <FirstName> <LastName> etc... </Person> <Person> ... In my project I already have a Person class with a required propertie...

Cocoa/Objective-C : Load password protected webpage

I am looking for a Cocoa class that will enable me to load a web page (html source) from a given URL. To make things a bit more complicated I need to be able to set user name and password for this contention since the access to web page is restricted. ...

UITableViewCell doesn't clear context before drawing

Hi, I have a subclass of UITableViewCell which contains several elements - UIImageViews, Labels, etc. Since this cell is intended to be reusable, I want to be able to change it's appearance a bit depending on what data it is currently displaying. So as an example - I have this view in my custom UITableViewCell: UIImageView* delime...

Objective-C: How Can I Access String Variable As a Global?

Hi, I am new to iPhone development. I want to access a string variable in all the class methods, and I want to access that string globally. How can I do this? Please help me out. ...

iPhone: Parse Integer out of NSURL/NSString (NSScanner?)

Hi, I am trying to build an iPhone App, where I read an RSS feed and have to parse out the id of an article from the URL. The links provided by the RSS feed are like the following: http://example.com/variable/path/components/352343/index.html I need 352343. So basically I need to search for at least one digit between slashes (path comp...

Launch Safari from iPhone App

I know that i can use the following code to launch my own url, but i want the user to continue their workflow after using my bookmarklet so therefore don't want to open a new tab and have them re-load the url i put into the url variable? NSURL url* = [NSURL URLWithString:@"http://google.com"]; [[UIApplication sharedApplication] openUrl:...

Difference between + and - methods in Objective-c

What is the difference between methods that are declared with - and methods that are declared with + e.g - (void)methodname + (void)methodname ...

Responder chains for nil-targeted actions and events

Hi, Do events (i.e. -keyDown: and -keyUp:) follow the same responder chain as nil-targeted actions? Thanks. ...

How to remove grey shadow on the top UIWebView when overscroll?

Hi, I'm using UIWebView for show a simple HTML page. When I scroll the page (over the top or over the bottom) a shadow gray appears behind!! Can I remove or avoid this bad effect? Thx P.S. UIWebView, View container, are all background clear and opaque NO!! ...

Confused by behaviour of NSBundle

Hi, I've a plist file that sits in a directory called Templates of my .app directory. This plist file is loaded thus without any problems: NSDictionary *sqlPropertyList = [NSDictionary dictionaryWithContentsOfFile:[[NSBundle mainBundle] pathForResource:CH_PQ_QUERIES ofType:@"plist"]]; I created a .txt file in the same directory and t...

How to pass the value of a variable to the subview in iphone?

I am new to iphone development.I am creating you tube RSS feed.In the first table view i am displaying the title, published data and image in every cell.All these contents are retrieved from the XML page by XML parsing.I have also parsed and retrieved the description to be displayed and stored it in a mutable array.On clicking a row it ...

Format string in Objective C

How can i format a string like "Fri Oct 17 00:00:00 +0200 2003" to a simple date string like Fri Oct 17 2003? Is there any easy solution? ...