cocoa-touch

UITableView Reusable cells

Can someone explain me the way reusable cells works for single table view? How many reusable cells a datasource should create? So far in all samples I've seen only one. Would one even need more? ...

Can you have two different text colors (in the same row) of a UITableViewCell?

I have a bunch of rows with more than one word in them, eg. "John Appleseed". I want the last word in each to be red, with the preceding words black. I know how I could rearrange the current label layout and have two with different colors, but I'm not sure that would work out. I'd have to create a label for "John" (with the width it nee...

How to access properties/methods in other classes

I have a RootViewController that has some UITabBarController properties: @interface RootViewController : UIViewController<LoginViewDelegate, UITabBarControllerDelegate> { UIBarButtonItem* loginButton; NSUserDefaults* prefs; UITabBarController* arTabBarController; UITabBarController* stvTabBarController; UITabB...

Make UIScrollView wrap around

Hi, I have a UIScroll which has eight or so pages. My aim is for them to 'loop' around so that when the user reaches the last page the first page will be the next page (and vice versa) so that the user could scroll through the pages endlessly. What is the best way to achieve this? I am working from this example from Cocoa with Love. ...

How can I assign properties correctly?

I have a UITabBarController that I would like to assign to another object, so that that object can control it: watchListView.tabBarController = self.stTabBarController; During this assignment the value of both self.stTabBarController and watchListView.tabBarController are 0x0. How can I assign the UITabBarController's? ...

How to switch tabs in UITabBarController?

I have a UITabBarController that is being presented modally from a RootViewController: stvTabBarController = [[UITabBarController alloc] init]; stvTabBarController.delegate = self; stvTabBarController.viewControllers = [NSArray arrayWithObjects:stvNavController, scheduleNavController, nil]; stvTabBarController.selectedViewController = s...

How to temporarily lock iPad/iPhone orientation

At a certain point in my application, I would like to temporarily disable the rotation feature - effectively "lock" the orientation in code, similar to what the lock toggle switch does on the iPad in hardware. I'm currently doing: [[UIDevice currentDevice] endGeneratingDeviceOrientationNotifications] and when I'm through, I call: [[...

Scrolling UITableView to valid index path throws error

Why would the following code throw this error? if ([self.tableView.dataSource numberOfSectionsInTableView:self.tableView] > 0 && [self.tableView.dataSource tableView:self.tableView numberOfRowsInSection:0] > 1) { [self.tableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:1 inSection:0] atScrollPosition:UITableViewScrollPosi...

Problems with converting a CGPoint to a string.

I have been having problems with converting a CGPoint to a string. I have tried various methods, but this seems like the most promising but it still won't work. Any suggestions? Here is my code: -(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { UITouch *touch = [[event allTouches] anyObject]; coord = [touch lo...

XCode translate matrix ala ActionScript?

Hi gang, I am wondering if there is a way to translate the underlying matrix of a layer much like you can in ActionScript3. In AS3 I can get the transform of a layer and shift it to, let's say, make the center of the layer the anchor point, rather than the upper-left corner. The reason I ask is because I am trying to rotate a layer (c...

iPhone: How to download a full website?

Hi, what approach do you recommend me for downloading a website (one HTML site with all included images) to the iPhone? The question is how to crawl all those tiny bits (Javascripts, images, CSS) and save them locally. It's not about the concrete implementation (I know how to use NSURLRequest and stuff. I'm looking for a crawl/spider ...

Objective C how to add textfield into navigation bar

Hi, I'm trying to add a textfield into a navigation bar, but it doesn't show up in the simulator. I do it as follows inside viewdidload: UITextView *textField = [[UITextView alloc] initWithFrame:CGRectMake(0, 0, 170, 44)]; self.navigationItem.titleView = textField; Any ideas? Thanks! ...

How to have images that do not resize when zooming in a UIScrollView?

I want to have images inside of a UIScrollView (or at least appear to be inside a UIScrollView) that don't change their size when zooming in and out. I do want the images to maintain their positions when zooming or scrolling. The use case is that I have a customized map view with pushpins. I want the pushpins to stay in place when zoo...

Networking Tasks Delay Interface

I have an application that requires loading data from a network for a UITableView from the Internet. However, this delays the loading of the view controller. Any ideas? ...

How can I detect if a viewController is no longer in the moreNavigationController?

I have a UITabBarController that has extra views in the moreNavigationController. I would like to be able to detect when the user has clicked Edit, and moves a view outside of moreNavigationController onto the regular UITabBarController items. How can I accomplish this? ...

YAJL-ObjC + Streaming Parser + gzip

I'm successfully using yajl-objc along with ASIHTTPRequest in an iPhone project that does network access and pulls down and parses JSON data. ASIHTTPRequest allows gzipped HTTP responses by default, which is great, but I'm using the streaming parser ability of YAJL and it rightfully chokes on gzipped data. I can wait until the HTTP requ...

Scroll UITableView row to top, even when table contains only a few rows

I have a UITableView which sometimes has only a few rows. I would like a specific row, e.g. the 2nd out of 3, to appear at the top of the table. However, when the number of rows do not fill the entire table, calling the following has no effect: [TableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:indexOfTopItem inSection:0] at...

how to display a text on to to my view below my tabel view ,that single line text must be scrolling

i have a view in which i have tabel view and i want to set up a text scrolling from left to right in the bottom of my main view ,.... what abt if i am select navigation bar for solve this purpose? can any suggest which i have choose to solve this.... any suggestions appreciated ...

iPhone - get number of days between two dates.

I'm writing a GTD app for the iPhone. For the due tasks, I want to display something like "Due tomorrow" or "Due yesterday" or "Due July 18th". Obviously, I need to display "Tomorrow" even if the task is less than 24 hours away (e.g. the user checks at 11pm on Saturday and sees there's a task on Sunday at 8am). So, I wrote a method to ge...

How to discover network devices with Cocoa Touch?

Hi, I want to be able to enumerate the names of devices on a local network from a device running iPhone OS 3.x (iPhone/iPad). I have tried using NSNetServiceBrowser to find all services like so: [serviceBrowser searchForServicesOfType:@"_services._dns-sd._udp." inDomain:@"local."]; this returns results but when I try and resolve the ...