Last active
October 12, 2015 06:58
-
-
Save imrekel/3988983 to your computer and use it in GitHub Desktop.
bme-ios - TouchCity
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UIStoryboard* storyboard = [UIStoryboard | |
storyboardWithName:@"Main" bundle:[NSBundle mainBundle]]; | |
TCBuildingInfoViewController* infoVC = [storyboard | |
instantiateViewControllerWithIdentifier:@"BuildingInfoViewController"]; | |
infoVC.building = _selectedBuilding; | |
UIPopoverController* popover = | |
[[UIPopoverController alloc] initWithContentViewController:infoVC]; | |
infoVC.popover = popover; | |
[popover presentPopoverFromRect:_selectedBuilding.frame inView:self.view | |
permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (IBAction)handleLongPress:(UILongPressGestureRecognizer *)sender | |
{ | |
if (sender.state == UIGestureRecognizerStateBegan) | |
{ | |
CGPoint touchPoint = [sender locationInView:self.scrollView]; | |
TCBuilding* building = | |
[[TCBuilding alloc] initWithBuildingType:self.buildingType]; | |
building.center = touchPoint; | |
[self.scrollView addSubview: building]; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (IBAction)handlePinch:(UIPinchGestureRecognizer *)sender | |
{ | |
CGFloat scaleFactor = [(UIPinchGestureRecognizer *)sender scale]; | |
CGAffineTransform scaleTransfrom = | |
CGAffineTransformMakeScale(scaleFactor, scaleFactor); | |
CGAffineTransform rotationTransform = | |
CGAffineTransformMakeRotation(_selectedBuilding.rotation); | |
_selectedBuilding.transform = | |
CGAffineTransformConcat(scaleTransfrom, rotationTransform); | |
if (sender.state == UIGestureRecognizerStateEnded) | |
{ | |
_selectedBuilding.bounds = | |
CGRectApplyAffineTransform(_selectedBuilding.bounds, | |
scaleTransfrom); | |
_selectedBuilding.transform = rotationTransform; | |
[_selectedBuilding setNeedsDisplay]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment