cocoa-touch

NSKeyedArchiver being called twice

When I look at the console while my iphone app is shutting down, it appears as though my encodewithcoder is being called twice. Even though I only encode an array of 'NewsItems' once. Is this normal? (void)encodeWithCoder:(NSCoder *)encoder { NSLog(@"News encode called %@", self.title); [encoder encodeObject:self.newsItemI...

Using core data, is the a way to automatically delete an entity when a to-many relationship falls below the min-count?

I have a core data model which includes an entity with a to-many relationship. I have set the relationship to non-optional and set the 'min count' to one. However, I can't work out a way of acting on this rule once it has been breached. Ideally I'd just like the entity deleted... but I can't figure out a way to do this automatically, or ...

UINavigationBar title and a right button

Hi, I have a navigation controller and in it a view controller: -NavigationController1 --MyViewController And as well I have another navigation controller - NavigationController2. I want to call MyViewController from another view controller - ViewController2, that was pushed into NavigationController2. -NavigationController2 -...

fill UIView with large sized text on the iPhone in Landscape

Hi, I have put my iPhone app in landscape mode and I want to put a message in one of my views that fills the screen. As of now a 6, 10 or 12 character message only goes up to about 12 point font in portrait view in interface builder. When I build and the iPhone simulator switches to landscape the font size stays the same as in portrait...

Overriding highlighted selection in UIPickerView

I have a custom UIPickerView where I use: -(UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view to populate the picker with UILabels. Is there a way to disable the behavior of highlighting the selected row when touched? I think this is a prop...

Switch single view based application view on iPhone

Hi, I have a simple view based application. I want to switch this original view for another view when I push a button on the original view. I do not want to use a navigationviewcontroller, or switchviewcontroller, I simply want to swap the root view for another. Thanks, Joe ...

Using NSPredicate to filter an NSArray based on NSDictionary keys

I have an array of dictionaries. I want to filter the array based on a key. I tried this: NSPredicate *predicate = [NSPredicate predicateWithFormat:@"(SPORT == %@)", @"Football"]; NSArray *filteredArray = [data filteredArrayUsingPredicate:predicate]; This doesn't work, I get no results. I think I'm doing something wrong. I know th...

[iPhone] Displaying a new view when selecting a row in a UITableView

I have an application with multiple views. I can click on different buttons to select different views, one of which displays a table. When I select a cell on that row, I want to display a new view. I see a log line indicating that view was loaded, but the screen doesn't change. - (void)tableView:(UITableView *)tableView didSelectRowA...

Make a UITextView selectable but not editable?

Hi, I am implementing a custom keyboard in my app. The thing is, I want to make it selectable so I can use the selectedRange property to get where the cursor is at. However, the only way to allow the user to select text in a UITextView is to make it editable, which brings up the keyboard. Is there a way to hide the keyboard, or place a ...

switch between uiviews with buttons and not uinavigation controllers

I have seen the post for http://stackoverflow.com/questions/584892/how-to-switch-views-by-buttons-on-iphone but this doesn't answer how to switch back and forth between views with buttons. The person that asked the question settled on the answer that they could switch between views with uinavigationcontroller. I put the following code...

accessoryButtonTappedForRowWithIndexPath is not being called

Hi, I have my app perfectly working on the simulator and on the iPhone OS 2.2.1 device. But I as well have a device with iPhone OS 3.0 installed. And when I tap on a disclosure button, the accessoryButtonTappedForRowWithIndexPath method is not being called, however color of a disclosure button becomes darker. Has anyone faced such an i...

Name conventions for xibs

I've been looking at the sample code and sometimes Apple names xib files ClassNameView and sometimes ClassNameViewController. The ClassName is always a UIViewController or UITableViewController, which had me wonder what convention to use when naming a xib. I would think View as it's not really the ViewController, but curious on what the ...

Function that processes touches

Hi, I have an UITableView and I want to detect double touches on UITableViewCell. I wanted to create a method, that will be called from the main app cycle and will process touches. (i.e. keep in memory time of 2 last touches and if the time is less than 0.5 of a second than it is a double touch) Is there a better way to achieve this? ...

Reusable TableView header views

Hi, For performance sake it is usual to reuse UITableView' cells. Is there a way to do the same thing with TableView header' views? I am talking about the ones that are returned with delegate's method: - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section I tried to do the following which doesn't se...

Possible to skin iPhone main (desktop) interface/background?

I know it's possible for jailbroken iPhones but does Apple provide any API for skinning the main mobile desktop interface/background? ...

Casting Objects in Cocoa touch

This sounds like a simple one but I can't find the solution anywhere. How do you cast objects in cocoa objective c for the iPhone? I'm trying to get the length of a string in an nsuinteger object like so: NSUInteger *phoneNumberLength = [phoneNumber length]; I get the warning initialization makes pointer from integer without...

Using a custom UIView from multiple view controllers

I have created a custom UIView that I would like to use on multiple different view controllers in my iPhone application. Currently, I have copied the UIView that contains the controls from the nib file for the first view controller, pasted it into the other view controllers, and then wired up all of the actions to each view controller. T...

Which icons/buttons to use for help, about, info?

I use the info button to display a settings page. This page is a modal. I need another button from here to display "About" info, since I've already used "info" for something. I have a search form that is accessed only from the modal. On the search form, I need a help icon. I can use the info button but that seems confusing, since I ...

Choose between view controllers

Hi, I have a certain UIViewController (ViewController1), which shows contents of a database. And I want to show another view controller(ViewController2) if the database was not loaded before. So when user enters ViewController1 and the database was not loaded before, I want to take him to ViewController2 instead of ViewController1. So...

UITableViewCell accessoryView not appearing until much later

I've got a UITableView with several entries. Upon selecting one, I need it to do a potentially time-consuming network operation. To give the user some feedback, I tried to place a UIActivityIndicatorView in the UITableViewCell. However, the spinner doesn't appear until much later -- after I've done the expensive operation! What am I doin...