cocoa-touch

Download File From short URL

Hi all, I want do download sound file from short url ( like: http://www.adjix.com ) When i try from normal link it's OK, but from short url, how first redirect and then download I use this part of code to create request: NSMutableURLRequest *theRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:urlToSound]]; NSURLConn...

Can you set a navbar's edit button in Interface Builder?

It's easy enough to set up a table view to allow editing. Just add one line to your UITableViewController: self.navigationItem.rightBarButtonItem = self.editButtonItem; This line adds an edit button on the nav bar that will change the table to editing mode and change its button text to "Done" while editing. Is it possible to set this...

Can the iPhone detect the size of a touch?

As far as I can tell the iPhone multitouch framework sends the location of each touch but not the size. I want to allow the user to tap a button with the tip of their thumb, or to put the pad of their thumb across multiple buttons (not real UIButtons) and have my touch tracking code realize it needs to press all the buttons the thumb is...

Cocoa/iPhone: BackgroundColor and Opaque Properties

In Cocoa, specifically the iPhone SDK, the opaque property is described as: If opaque, the drawing operation assumes that the view fills its bounds and can draw more efficiently. The results are unpredictable if opaque and the view doesn’t fill its bounds. Set this property to NO if the view is fully or partially transpar...

How do I have a view controller run updating code when it is brought to the top of the stack of views?

Hi-- I have a viewController (Planner) that loads two view controllers (InfoEditor and MonthlyPlan) when the application starts. MonthlyPlan is hidden behind InfoEditor (on load). So my question is when I exchange InfoEditor for MonthlyPlan (MonthlyPlan gets brought to the top) how can I have data on the MonthlyPlan view be updated. ...

How to specify decimal places when formatting NSNumber objects?

I'm using the following piece of Objective-C code to format a NSNumber, and it works fine most of the time, but it doesn't quite do what I want when the NSNumber object holds an integer (no fractional part). UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(80.0f, 90.0f, 225.0f, 40.0f)]; label.backgroundColor = [UIColor clearCo...

Parsing a URL from XML with & in it

I am trying to parse a URL with an & in the URL: ViewArticle.dbml?DB_OEM_ID=1800&ATCLID=3664162 ..but using NSXMLParser, all i get is 1800ATCL. It completely ignores the &. - (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName att...

How to create backBarButtomItem with custom view for a UINavigationController

I have a UINavigationController into which I push several views. Inside viewDidLoad for one of these views I want to set the self.navigationItem.backBarButtonItem to a custom view (based on a custom image). I don't know why, but it doesn't seem to work. Instead, I get the standard "back" button. UIButton *backButton = [[UIButton alloc] ...

Getting the value of an Element in Cocoa using TouchXML

I am using TouchXml because of the given limitations of NSXML on the actual iPhone. Anyway, I'm just starting out with Objective-C, I come from a C# background, and felt like learning something new..anyhow.. here is my xml file... <?xml version="1.0" encoding="utf-8"?> <FundInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmln...

How can I generate graphical (chart) report?

I am developing an iPhone app using Cocoa Touch and SQLite. I want to generate a graphical (chart) report. How can I generate a graphical chart report? Are there any tools for generation graphical report easily? ...

UIView based animation

Hi, I'm trying to animate some UIImageViews for a 2D game. Using [UiView begin/commit animation] is out of the question, since I need to determine the positions of all Image Views at all times. Instead I'm changing the frame.origin.x/y in my UIImageViews to manualy control my animations. My problem is that the framerate drops significan...

UITextView automatic scroll down

i have an uiview and i add a editable UITextView to it UITextView *textView = [[UITextView alloc] initWithFrame:CGRectMake(5, 5, 219, 47)]; [self addSubview:textView]; textView.font = [UIFont systemFontOfSize:14]; when i type it doesn't go down automatic. anybody got an idea? ...

GPRS on iPhone Simulator

I want to activate/enable GPRS on the iPhone programmatically. What are the APIs I can look into? There is no "Network" option in the settings application on the simulator so do I need to test out the application on the device itself? ...

How should I structure this application?

I am writing an iPhone application which requires the user to enter their mobile no and pin code and press an accept button before they continue into the application. Previously I had (each view is in a different Xib) AppDelegate - if {registered add load RootView (which is main view) into NavigationController} else {load RegistrationV...

How make a view of thumbnails in landscape mode?

I have a view with the task to show a bunch of images (similar to the photos app). In the top area is the full-size image and in the bottom a list of images. Let's say exist 100 images. Now the user is on the 15-20 image section and is on the image 16. Now, my problem is how aproach this. I wanna something that work like the UITableVi...

-[NSURLRequest sendSynchronousRequest:returningResponse:error:] getting back HTTP headers

I'm trying to pull out HTTP Headers and an HTTP Response Code from a synchronous HTTP request on the iPhone. I generally don't have any issues doing this with asynchronous requests, although a bit of trouble here. The HTTP Response Headers are null and HTTP Status Code is 0. Web server is configured proper and I can retrieve the details ...

Lazy load images in UITableViewCell

Hi I have some 50 custom cells in my UITableView. I want to display an image and a label in the cells where I get the images from URLs. I want to do a lazy load of images so the UI does not freeze up while the images are being loaded. I tried getting the images in separate threads but I have to load each image every time a cell becomes...

String manipulation without memory leaks?

I'd like to do a series of string substitutions to removed xml-escaped chars such as '&amp;'. 1) Is there an existing UIKit function that can do this? 2) If not, what's the best way to do it without leaking memory? Here's the idea: -(NSString*) unescape:(NSString*)string { string = [string stringByReplacingOccurrencesOfString:@"&...

Emailing an image from an application

What's the best way of sending an email with an image from the application to the Mail.app for someone to send to any contact they like? For example, in my app (iMood), you can select a 'mood', I'd like the user to be able to email this to a friend for example, by using a button in the navigation bar. I can easily create the button etc...

Cell background colour only shows up to the text

I have gone as far as to use the following code to set the background colour of a TableView cell (in cellForRowAtIndexPath) - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWi...