cocoa-touch

how can load images from plist in to UITableView ?

I have stored the videos and the thumbnail images of the videos in Documents folder. And I have given the path in plist. In plist I took an array and I added directories to the array. And in the dictionary I stored the image path /Users/srikanth/Library/Application Support/iPhone Simulator/User/Applications/9E6E8B22-C946-4442-9209-75B...

Double-spaced textfield in CocoaTouch (iPhone)

Hi there, Can I have a double-spaced UITextView? I mean, so that it retains its formatting when I edit it? I need to display graphical elements in between the lines of text. Any ideas? Thanks! ...

UITextField in UITableView to becomeFirstResponder.

Hi ! I have a problem which I dont have a clue how to work around. Maybe anyone of you could help me to the correct directions... Simple I have a UITableView with each cell containing a UITextField. When I´m editing a cell (UITextField) and hit Return Key, a new row is inserted under the current cell. After that I reloadData on t...

How can get image from a path in to UITAbleViewCell ?

I have the following path in NSString *path1, /Users/srikanth/Library/Application Support/iPhone Simulator/User/Applications/9E6E8B22-C946-4442-9209-75BB0E924434/Documents/snook.jpg How can I show the image snook.jpg. I need it to show in UITableViewCell for cell.imageView.image if path1 has the path. I used the following to...

How to calculate the height of the text rectangle from an NSString?

I know there is this one: sizeWithFont:minFontSize:actualFontSize:forWidth:lineBreakMode: But since the CGSize always has the same height and doesn't adjust to any shrinked text or whatsoever, the CGSize is not telling how heigh the text is. Example: Make a UILabel with 320 x 55 points and put a loooooooooooooong text in there. Let t...

Stop Core Location updates then restart them with a timer

I was wondering if anyone could point me to (or paste in) some code to deal with turning off Core Location updates to save power. As far as I understand it, you should stop Core Location updates as soon as you get a reading of desired accuracy. If you don't get a good accuracy reading after a certain time, you should also stop updates (...

Do I need to add <UIAlertViewDelegate> protocol?

I have added an alertView to display an alert message to the user (see below) -(void)connectionAlert { UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"UIAlertView" message:@"<Alert message>" delegate:self cancelButtonTitle:@"OK" otherButtonTitles: nil]; [alert show]; [alert...

How to compare two times in milliseconds precision?

I have a subtitle text file that works with standart srt format 00:00:00,000 Hour, minutes, seconds, milliseconds. I want to create a timer to update the subtitle screen and check the current time to know what subtitle show on screen. Which is the best to use? NSTimeInterval, NSDate? I think the best is to convert all to times to mil...

Optimizing text searching using NSFetchedResultsController & Core Data

I have a tableview with a NSFetchedResultsController data source, displaying a list of names from the underlying Core Data SQLite store. I have implemented a search bar. When the first character is entered in the search bar, a fetch request in the following form is executed: NSPredicate *searchPredicate = [NSPredicate predicateWithForma...

NSString stringWithFormat question

I am trying to build a small table using NSString. I cannot seem to format the strings properly. Here is what I have [NSString stringWithFormat:@"%8@: %.6f",e,v] where e is an NSString from somewhere else, and v is a float. What I want is output something like this: Grapes: 20.3 Pomegranates: 2.5 Oranges: 15.1 What I ...

Predicate for searching the first letter of each word in a string of words

I would like to create a predicate to search for a specific letter at the start of each word in a string of words e.g. all words starting with A in @"The man ate apples", would return ate and apples. Is it possible to create such a predicate? Thank you. ...

Set the position of a UIBarButtonItem Programmatically.

How would I be able to set the position of a UIBarButtonItem? Like, I would like to set it to be on either the very right of a UIToolbar or the very left depending on a state. Thank you. ...

I need help to debug my XML parsing please

I'm parsing this line: <type>branch</type> with this code in didEndElement if ([elementName isEqualToString:@"type"]) { [currentBranchDictionary setValue:currentText forKey:currentElementName]; } When I test the value in the type key, it does not contain branch but instead it contains branch\n. Here is the test I'm ...

Is there a way to stop a UIViewController from being popped from a UINavigationController's stack when the backBarButtonItem is tapped?

I have a UINavigationController with a root view controller and then I push a UIViewController onto the navigation controller's stack. When the user taps the backBarButtonItem I'd like to be able to have an alert view pop up if there are certain conditions met and cancel the pop of the view controller. For example, the user can make ce...

How to simulate a mouse click on a UIWebView in Cocoa for the iPhone?

I'm trying to setup automated unit tests for an iPhone application. I'm using a UIWebView and need to simulate clicks on different links. I've tried doing this with JavaScript, but it doesn't produce the same result as when I manually click on the links. The main problem is with links that have their target property set. When you manual...

How can I play video by touching the button on the video thumnail of the video in tableviewcell ?

I have a table view in which if each cell is touched a video plays. Each cell have image of the video cell.imageView.image. And on the image I have a button (UIButton) with play symbol. If I touch the play button the corresponding video should be played same like the when cell is touched. I have a selector for the play button. But ...

How to determine the height of text in UITextView?

What is a good way to determine the current height of the content height in a UITextView? ...

Get Object ID of UI element from code.

I'm trying link 40 buttons to one event handler method and then do the processing work from one method instead of 40. I know how to link it but once I get there I don't know how to distinguish what button was pressed. Does anyone know how to reference the button object sender id or is there another way to solve this problem? Any hel...

Table View Controller Problems

Hello, I added a table view into a view in interface builder and now I need to wire it up to some pre-made classes that you can generate in xcode. I set the tableview controller's class to the class in xcode and wired the dataSource and delegate to my table view but the app just crashes. Im not sure how to get data to properly load into...

UIWebView paging / line cut off

Hi, I am trying to page a webpage, so disable scrolling, then the second page is the same webpage scrolled down the page height. The problem I have is that the bottom of the first page often has 1/2 a line of text, then the second page has the bottom half of the line. Is there a way to ensure the entire line falls on one of the pages?...