Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Добавелено отображение осей

  • Loading branch information...
commit 4e418b9e1987eb5bcad49ba241dbf43c0b9bb1a1 1 parent e207bee
@abogushevsky authored
View
BIN  .DS_Store
Binary file not shown
View
10 Calculator.xcodeproj/project.pbxproj
@@ -11,6 +11,7 @@
2C0EF6B7161CBE5F00E6FCEE /* CalculatorGraphView.m in Sources */ = {isa = PBXBuildFile; fileRef = 2C0EF6B6161CBE5F00E6FCEE /* CalculatorGraphView.m */; };
2C150F11161F4BFD00A11E42 /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 2C150F10161F4BFD00A11E42 /* Default-568h@2x.png */; };
2C3C03361621A1740082FE70 /* CalculatorGraphViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2C3C03351621A1740082FE70 /* CalculatorGraphViewController.m */; };
+ 2C3C03481621AE290082FE70 /* AxesDrawer.m in Sources */ = {isa = PBXBuildFile; fileRef = 2C3C032E16219CDD0082FE70 /* AxesDrawer.m */; };
E6B87D4A15769D2700DB8377 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E6B87D4915769D2700DB8377 /* UIKit.framework */; };
E6B87D4C15769D2700DB8377 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E6B87D4B15769D2700DB8377 /* Foundation.framework */; };
E6B87D4E15769D2700DB8377 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E6B87D4D15769D2700DB8377 /* CoreGraphics.framework */; };
@@ -194,6 +195,7 @@
E6BBAABE157AB825007510F5 /* CalculatorBrain.m in Sources */,
2C0EF6B7161CBE5F00E6FCEE /* CalculatorGraphView.m in Sources */,
2C3C03361621A1740082FE70 /* CalculatorGraphViewController.m in Sources */,
+ 2C3C03481621AE290082FE70 /* AxesDrawer.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -239,7 +241,7 @@
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
- IPHONEOS_DEPLOYMENT_TARGET = 5.1;
+ IPHONEOS_DEPLOYMENT_TARGET = 6.0;
SDKROOT = iphoneos;
};
name = Debug;
@@ -257,7 +259,7 @@
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
- IPHONEOS_DEPLOYMENT_TARGET = 5.1;
+ IPHONEOS_DEPLOYMENT_TARGET = 6.0;
OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1";
SDKROOT = iphoneos;
VALIDATE_PRODUCT = YES;
@@ -300,7 +302,7 @@
E6B87D6215769D2800DB8377 /* Release */,
);
defaultConfigurationIsVisible = 0;
- defaultConfigurationName = Release;
+ defaultConfigurationName = Debug;
};
E6B87D6315769D2800DB8377 /* Build configuration list for PBXNativeTarget "Calculator" */ = {
isa = XCConfigurationList;
@@ -309,7 +311,7 @@
E6B87D6515769D2800DB8377 /* Release */,
);
defaultConfigurationIsVisible = 0;
- defaultConfigurationName = Release;
+ defaultConfigurationName = Debug;
};
/* End XCConfigurationList section */
};
View
BIN  Calculator.xcodeproj/project.xcworkspace/xcuserdata/NamelessOne.xcuserdatad/UserInterfaceState.xcuserstate
Binary file not shown
View
BIN  Calculator/.DS_Store
Binary file not shown
View
3  Calculator/CalculatorGraphView.h
@@ -7,7 +7,10 @@
//
#import <UIKit/UIKit.h>
+#import "AxesDrawer.h"
@interface CalculatorGraphView : UIView
+@property (nonatomic) CGFloat scale;
+
@end
View
56 Calculator/CalculatorGraphView.m
@@ -10,6 +10,30 @@
@implementation CalculatorGraphView
+@synthesize scale = _scale;
+
+#define DEFAULT_SCALE 0.90
+
+-(CGFloat) scale
+{
+ if(!_scale)
+ {
+ return DEFAULT_SCALE;
+ }
+ else
+ {
+ return _scale;
+ }
+}
+
+-(void) setScale:(CGFloat)scale
+{
+ if(scale != _scale) {
+ _scale = scale;
+ [self setNeedsDisplay];
+ }
+}
+
- (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
@@ -19,13 +43,33 @@ - (id)initWithFrame:(CGRect)frame
return self;
}
-/*
-// Only override drawRect: if you perform custom drawing.
-// An empty implementation adversely affects performance during animation.
-- (void)drawRect:(CGRect)rect
+- (void)drawCircleAtPoint:(CGPoint)p withRadius:(CGFloat)radius inContext:(CGContextRef)context
+{
+ UIGraphicsPushContext(context);
+ CGContextBeginPath(context);
+ CGContextAddArc(context, p.x, p.y, radius, 0, 2*M_PI, YES); // 360 degree (0 to 2pi) arc
+ CGContextStrokePath(context);
+ UIGraphicsPopContext();
+}
+
+-(void) drawRect:(CGRect)rect
{
- // Drawing code
+ //CGContextRef context = UIGraphicsGetCurrentContext();
+
+ CGPoint midPoint; // center of our bounds in our coordinate system
+ midPoint.x = self.bounds.origin.x + self.bounds.size.width/2;
+ midPoint.y = self.bounds.origin.y + self.bounds.size.height/2;
+
+ [AxesDrawer drawAxesInRect:self.bounds originAtPoint:midPoint scale:self.scale];
+
+ /*CGFloat size = self.bounds.size.width / 2;
+ if (self.bounds.size.height < self.bounds.size.width) size = self.bounds.size.height / 2;
+ size *= self.scale; // scale is percentage of full view size
+
+ CGContextSetLineWidth(context, 5.0);
+ [[UIColor blueColor] setStroke];
+
+ [self drawCircleAtPoint:midPoint withRadius:size inContext:context]; // head*/
}
-*/
@end
View
25 Calculator/MainStoryBoard_iPad.storyboard
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="2.0" toolsVersion="2840" systemVersion="12C54" targetRuntime="iOS.CocoaTouch.iPad" propertyAccessControl="none" useAutolayout="YES" initialViewController="J6h-rD-brX">
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="2.0" toolsVersion="2843" systemVersion="12C60" targetRuntime="iOS.CocoaTouch.iPad" propertyAccessControl="none" useAutolayout="YES" initialViewController="J6h-rD-brX">
<dependencies>
- <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="1926"/>
+ <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="1929"/>
</dependencies>
<scenes>
<!--Calculator View Controller - Calculator-->
@@ -490,14 +490,25 @@
</objects>
<point key="canvasLocation" x="2880" y="-592"/>
</scene>
- <!--View Controller - Graph-->
+ <!--Calculator Graph View Controller - Graph-->
<scene sceneID="v7Y-f1-EXh">
<objects>
- <viewController id="50C-GG-6gf" sceneMemberID="viewController">
+ <viewController id="50C-GG-6gf" customClass="CalculatorGraphViewController" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="7Ua-oT-Ht9">
<rect key="frame" x="0.0" y="64" width="768" height="960"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
+ <subviews>
+ <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Zg6-C6-Aro" customClass="CalculatorGraphView">
+ <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
+ </view>
+ </subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
+ <constraints>
+ <constraint firstItem="Zg6-C6-Aro" firstAttribute="leading" secondItem="7Ua-oT-Ht9" secondAttribute="leading" type="default" id="bvF-Ch-V0L"/>
+ <constraint firstItem="Zg6-C6-Aro" firstAttribute="bottom" secondItem="7Ua-oT-Ht9" secondAttribute="bottom" type="default" id="bzo-Ys-qOK"/>
+ <constraint firstItem="Zg6-C6-Aro" firstAttribute="trailing" secondItem="7Ua-oT-Ht9" secondAttribute="trailing" type="default" id="dEz-PL-ILZ"/>
+ <constraint firstItem="Zg6-C6-Aro" firstAttribute="top" secondItem="7Ua-oT-Ht9" secondAttribute="top" type="default" id="hb6-88-rlU"/>
+ </constraints>
</view>
<navigationItem key="navigationItem" title="Graph" id="G6n-Yg-JE5"/>
</viewController>
@@ -525,6 +536,12 @@
</scene>
</scenes>
<classes>
+ <class className="CalculatorGraphView" superclassName="UIView">
+ <source key="sourceIdentifier" type="project" relativePath="./Classes/CalculatorGraphView.h"/>
+ </class>
+ <class className="CalculatorGraphViewController" superclassName="UIViewController">
+ <source key="sourceIdentifier" type="project" relativePath="./Classes/CalculatorGraphViewController.h"/>
+ </class>
<class className="CalculatorViewController" superclassName="UIViewController">
<source key="sourceIdentifier" type="project" relativePath="./Classes/CalculatorViewController.h"/>
<relationships>
View
27 Calculator/en.lproj/MainStoryboard.storyboard
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="2.0" toolsVersion="2840" systemVersion="12C54" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" initialViewController="xZR-Un-yKi">
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="2.0" toolsVersion="2843" systemVersion="12C60" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" initialViewController="xZR-Un-yKi">
<dependencies>
- <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="1926"/>
+ <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="1929"/>
</dependencies>
<scenes>
<!--Calculator View Controller - Calculator-->
@@ -414,21 +414,19 @@
</objects>
<point key="canvasLocation" x="404" y="211"/>
</scene>
- <!--View Controller - Graph-->
+ <!--Calculator Graph View Controller - Graph-->
<scene sceneID="593-75-IcH">
<objects>
- <viewController id="nTt-8A-PFn" sceneMemberID="viewController">
+ <viewController id="nTt-8A-PFn" customClass="CalculatorGraphViewController" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="eXB-im-qMX">
<rect key="frame" x="0.0" y="64" width="320" height="416"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
- <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="Hello graph!" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="rkh-ae-aeq">
- <rect key="frame" x="20" y="39" width="280" height="54"/>
- <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
- <fontDescription key="fontDescription" type="system" pointSize="23"/>
- <color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
- <nil key="highlightedColor"/>
- </label>
+ <view contentMode="scaleToFill" id="ZSP-bp-OXe" customClass="CalculatorGraphView">
+ <rect key="frame" x="0.0" y="0.0" width="320" height="416"/>
+ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+ <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
+ </view>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
</view>
@@ -458,6 +456,12 @@
</scene>
</scenes>
<classes>
+ <class className="CalculatorGraphView" superclassName="UIView">
+ <source key="sourceIdentifier" type="project" relativePath="./Classes/CalculatorGraphView.h"/>
+ </class>
+ <class className="CalculatorGraphViewController" superclassName="UIViewController">
+ <source key="sourceIdentifier" type="project" relativePath="./Classes/CalculatorGraphViewController.h"/>
+ </class>
<class className="CalculatorViewController" superclassName="UIViewController">
<source key="sourceIdentifier" type="project" relativePath="./Classes/CalculatorViewController.h"/>
<relationships>
@@ -469,7 +473,6 @@
<relationship kind="action" name="undoPressed:" candidateClass="UIButton"/>
<relationship kind="action" name="variablePressed:" candidateClass="UIButton"/>
<relationship kind="outlet" name="display" candidateClass="UILabel"/>
- <relationship kind="outlet" name="displayVariables" candidateClass="UILabel"/>
<relationship kind="outlet" name="historyDisplay" candidateClass="UILabel"/>
</relationships>
</class>
Please sign in to comment.
Something went wrong with that request. Please try again.