Making a SKScene’s background transparent not working… is this a bug?

In iOS 8, you can set the scene’s SKView to allow transparency and set the scene’s background color to have transparency. Then views behind the SKView will be seen. UIView *parentView = …; [parentView addSubview:backgroundView]; [parentView addSubview:skViewWithScene]; skViewWithScene.allowsTransparency = YES; scene.backgroundColor = [UIColor clearColor]; [skViewWithScene presentScene:scene];

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

How can you add a UIGestureRecognizer to a UIBarButtonItem as in the common undo/redo UIPopoverController scheme on iPad apps?

Note: this no longer works as of iOS 11 In lieu of that mess with trying to find the UIBarButtonItem’s view in the toolbar’s subview list, you can also try this, once the item is added to the toolbar: [barButtonItem valueForKey:@”view”]; This uses the Key-Value Coding framework to access the UIBarButtonItem’s private _view variable, where … Read more

Universal application with Portrait orientation for iPhone and Landscape orientation for iPad

Go to the info.plist file and add an array with key “Supported interface orientations (iPhone)” and add the following values in it: Portrait (bottom home button) Similarly, add another array “Supported interface orientations (iPad)” and add the following: Portrait (bottom home button) Landscape (left home button) Landscape (right home button) See below:

UICollectionView horizontal paging with 3 items

Edit: Demo link: https://github.com/raheelsadiq/UICollectionView-horizontal-paging-with-3-items After a lot searching I did it, find the next point to scroll to and disable the paging. In scrollviewWillEndDragging scroll to next cell x. – (void)scrollViewWillEndDragging:(UIScrollView *)scrollView withVelocity:(CGPoint)velocity targetContentOffset:(inout CGPoint *)targetContentOffset { float pageWidth = 480 + 50; // width + space float currentOffset = scrollView.contentOffset.x; float targetOffset = targetContentOffset->x; … Read more