cocoa-touch

Placing calls to super?

I have asked this before, but the more I look at other code examples the more I see differences in layout. Usually I try and put the call to super at the start (if its a creation type method) or at the end (if its a destroy type method) (see below...) -(void)viewDidLoad { [super viewDidLoad]; ... ... } . -(void)viewDidUnload...

Using Distance of two touches in real-time?

Hello, i want to receive the changed distance of two touches in my program after "pinching". First, i start with the touchesBegan: - (CGFloat)distanceBetweenTwoPoints:(CGPoint)fromPoint toPoint:(CGPoint)toPoint { float x = toPoint.x - fromPoint.x; float y = toPoint.y - fromPoint.y; return sqrt(x * x + y * y); } - (void)touchesBe...

How do I chain two UIGestureRecognizers together?

What I would like to do is to detect a swipe gesture followed by a pan gesture as part of the same touch sequence. So the user first swipes an object to carry out an action, then, while keeping their finger on the screen, moves up/down to propagate the action to surrounding objects. I have a swipe gesture recognizer and a pan gesture r...

Is it possible to use Cocoa Touch gesture recognizers with layers / CALayer objects?

Is it possible to use gesture recognizers with layers? Let's say I want to add several sublayers to my view and implement drag&drop as well as tapping on single element. Is it possible at all ? What is the best pattern? ...

Using Core Data as a model when not all objects will be stored

Hello, I'm working on an iPhone application that downloads data from a web server and I sometimes, but not always, want to cache the results of these downloads. The entity I'm dealing with is an Event. Events appear in the UI in the following ways: as the result of a location-based search as the result of a keyword-based search a list...

Vectors in Cocoa Touch / Objective-C

Hi all, Is it possible to use vectors in Coca Touch? If so, what library must be included? I was following a general C tutorial on them an the only thing needed was to #include <vector> But XCode states that there is no such file or directory. Any pointer to a library that provides such functionality is appreciated. Regards ~dhp ...

When using a view with a webView in, the shake gesture is not always detected

Hi all, this is my first post and i have looked all over for a week or so now so i'm not sure if there is an answer out there or not. I have an iPhone application (my first one) that has a view that includes a UIWebView. The view responds to the shake gesture and then loads a modal view controller that includes navigation buttons for...

UIView parent window's frame and bound dimensions while rotating iPad

I a have a following line of code invoked after a touch gesture has completed: CGRect parentBounds = self.view.bounds; CGRect parentFrame = self.view.frame; when iPad is placed in a vertical way both parentFrame and parentBounds have similar dimensions of w:768 h:1004 (or something close to that), but when I rotate parentBounds is 102...

UISearchDisplayController is not displaying any cells

I have a UISearchDisplayController that is properly hooked up in IB. delegate = Files Owner searchBar = Search Bar searchContentsController = Files Owner searchResultsDataSource = Files Owner searchResultsDelegate = Files Owner When my UITableView calls numberofRowsInSection the correct number is returned. However, my cells in cellFo...

How can I stop a UISearchDisplayController from updating as I type?

How can I stop a UISearchDisplayController from updating as I type? numberOfRowsInSection gets called many times as the user types. ...

Avoid UITableViewCell moving when toggling between editing mode

Alright, I have some weird behavior and this question goes to the people out there that got that issue already. I have 4 different subclasses of UITableViewCells. They are all very similar (I can't see the differences that would bring the problem up). Now my UITableView's delegate have the following code: - (UITableViewCellEditingStyl...

Using UIPanGestureRecognizer and CATransform3DScale to enlarge dragged element

I want to implement a delayed 'enlarging' animation on an UIView that is being dragged using an attached UIPanGestureRecognizer. I've been using something similar to the following code: UIView* innerView; CGPoint startingPoint; - (void)viewDidLoad { innerView = [[[UIView alloc] autorelease] initWithFrame:CGRectMake(0, 0, 200, ...

How do I trigger execution of a method within an iPhone application from Javascript?

Is it possible to trigger the execution of a method within an iPhone application from Javascript on a web page? For example, I'd like to have a button that opens the iPhone camera application. Is this possible? ...

Iphone - DismissModalViewControllerAnimated within imagePickerController

Hi, Lets say I have a controller class A which implements UIImagePickerControllerDelegate. within A , I implement the delegate like this : -(void) imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)image editingInfo:(NSDictionary *)editingInfo { [self dismissModalViewControllerAnimated:YES]; ...

Android SDK vs iPhone SDK

I've been using the iPhone SDK and think it's great. How does the Android SDK compare? I've never used the Android SDK so I'm wondering what the similarities are. Does it have something like Interface Builder? Does it follow the MVC paradigm? What language does it use? The iPhone SDK has about 20 years of history behind it so it is quit...

Universal app iPad / iPhone with seperate recources?

i have build an universal app i have assets that are for both but i have a couple assets ( embeded movie's ) that are only for iphone or only for ipad. is there a possibility to make 2 builds 1 for iphone and 1 for ipad so that the iphone app doesn't grow to large? ...

- (void)applicationWillTerminate:(UIApplication *)application

I found this method in a delegate file and inserted some code. The code never gets executed, even when the home button is pressed. When or how does this function get called? ...

- (void)applicationDidEnterBackground:(UIApplication *)application

I inserted an NSLog and a UIAlertView into this function call. When I pressed the home button, the NSLog executed, but not the UIAlertView. Why is that? ...

UIView Animations

Why doesn't this code do anything? [UIView beginAnimations:@"View Flip" context:nil]; [UIView setAnimationDuration:1]; [UIView setAnimationCurve:UIViewAnimationCurveEaseIn]; [UIView setAnimationTransition:UIViewAnimationCurveEaseIn forView:self.view cache:YES]; [self.view removeFromSuperview]; [UIView commitAnimations]; Also, where ...

How to remove searchResultsTableView?

I have a UISearchDisplayController that displays some cells after a user has searched. After the user clicks on the cell, I am pushing a new view to my nav stack. How can I remove searchResultsTableView from the view so that when the user goes back, he doesn't see the searchResultsTableView? ...