UIPinchGestureRecognizer position the pinched view between the two fingers

You can get the CGPoint of the midpoint between two fingers via the following code in the method handlingPinchGesture. CGPoint point = [sender locationInView:self]; My whole handlePinchGesture method is below. /* instance variables CGFloat lastScale; CGPoint lastPoint; */ – (void)handlePinchGesture:(UIPinchGestureRecognizer *)sender { if ([sender numberOfTouches] < 2) return; if (sender.state == UIGestureRecognizerStateBegan) { lastScale = … Read more

UIModalPresentationFormSheet resizing view

MyModalViewController *targetController = [[[MyModalViewController alloc] init] autorelease]; targetController.modalPresentationStyle = UIModalPresentationFormSheet; targetController.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal; [self presentModalViewController:targetController animated:YES]; // it is important to do this after presentModalViewController:animated: targetController.view.superview.bounds = CGRectMake(0, 0, 200, 200);

Popovers cannot be presented from a view which does not have a window

the thing that saved my life: if (self.view.window != nil) [popoverController presentPopoverFromRect:CGRectMake(44, yCoord, 111, 111) inView:self.view permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES]; by adding if condition it doesn´t crash anymore. I don´t really get it because the presentPopoverFromRect function is ALWAYS called. There is no situation where window would be nil but anyway it did the trick. edit: I … Read more

Multiple “apple-touch-startup-image” resolutions for iOS web app (esp. for iPad)?

definitive solution for startup-image and touch-icons for iPad and iPhone (landscape || portrait) and (retina || not): <!– iPhone ICON –> <link href=”https://stackoverflow.com/questions/4687698/apple-touch-icon-57×57.png” sizes=”57×57″ rel=”apple-touch-icon”> <!– iPad ICON–> <link href=”apple-touch-icon-72×72.png” sizes=”72×72″ rel=”apple-touch-icon”> <!– iPhone (Retina) ICON–> <link href=”apple-touch-icon-114×114.png” sizes=”114×114″ rel=”apple-touch-icon”> <!– iPad (Retina) ICON–> <link href=”apple-touch-icon-144×144.png” sizes=”144×144″ rel=”apple-touch-icon”> <!– iPhone SPLASHSCREEN–> <link href=”apple-touch-startup-image-320×460.png” media=”(device-width: 320px)” … Read more

Get current orientation of iPad?

Orientation information isn’t very consistent, and there are several approaches. If in a view controller, you can use the interfaceOrientation property. From other places you can call: [[UIDevice currentDevice] orientation] Alternatively, you can request to receive orientation change notifications: [[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(orientationChanged:) name:UIDeviceOrientationDidChangeNotification object:nil]; Some people also like to check the … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)