Skip to content

Commit

Permalink
#5: Enforce a square control. (Square images still not enforced.)
Browse files Browse the repository at this point in the history
  • Loading branch information
jdee committed May 30, 2014
1 parent afecfde commit fa56dc9
Show file tree
Hide file tree
Showing 13 changed files with 20 additions and 16 deletions.
6 changes: 3 additions & 3 deletions IOSKnobControl.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ typedef NS_ENUM(NSInteger, IKCGesture) {
* transparent background or a solid one that matches the view behind it. However, the aspect
* ratio must be 1:1. The effect of the animation is circular rotation. This only works if the control
* is square. You can produce other effects, for example, by partially clipping a square control
* or using an oblong background. But the control itself always has to be square.
*
* DEBT: Enforce this. https://github.com/jdee/ios-knob-control/issues/5
* or using an oblong background. But the control itself always has to be square. If an oblong frame is specified
* for the control, the frame will be made square. The larger of the original sides will will be used for both the
* width and height. The origin of the frame will be unchanged.
*
* The knob control requires ARC, and hence iOS 5.0 or later. It has not been tested below iOS 6.1.
*/
Expand Down
5 changes: 5 additions & 0 deletions IOSKnobControl.m
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ static CGRect adjustFrame(CGRect frame) {
const float IKC_MINIMUM_DIMENSION = ceil(9.72 * IKC_FINGER_HOLE_RADIUS);
if (frame.size.width < IKC_MINIMUM_DIMENSION) frame.size.width = IKC_MINIMUM_DIMENSION;
if (frame.size.height < IKC_MINIMUM_DIMENSION) frame.size.height = IKC_MINIMUM_DIMENSION;

// force the frame to be square. choose the larger of the two dimensions as the square side in case it's not.
float side = MAX(frame.size.width, frame.size.height);
frame.size.width = frame.size.height = side;

return frame;
}

Expand Down
2 changes: 1 addition & 1 deletion doc/html/_i_o_s_knob_control_8h_source.html
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Fri May 30 2014 11:14:17 for iOS Knob Control by &#160;<a href="http://www.doxygen.org/index.html">
Generated on Fri May 30 2014 14:41:20 for iOS Knob Control by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.5
</small></address>
Expand Down
2 changes: 1 addition & 1 deletion doc/html/annotated.html
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Fri May 30 2014 11:14:17 for iOS Knob Control by &#160;<a href="http://www.doxygen.org/index.html">
Generated on Fri May 30 2014 14:41:20 for iOS Knob Control by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.5
</small></address>
Expand Down
2 changes: 1 addition & 1 deletion doc/html/class_i_o_s_knob_control-members.html
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@
</table></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Fri May 30 2014 11:14:17 for iOS Knob Control by &#160;<a href="http://www.doxygen.org/index.html">
Generated on Fri May 30 2014 14:41:20 for iOS Knob Control by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.5
</small></address>
Expand Down
2 changes: 1 addition & 1 deletion doc/html/classes.html
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Fri May 30 2014 11:14:17 for iOS Knob Control by &#160;<a href="http://www.doxygen.org/index.html">
Generated on Fri May 30 2014 14:41:20 for iOS Knob Control by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.5
</small></address>
Expand Down
2 changes: 1 addition & 1 deletion doc/html/files.html
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Fri May 30 2014 11:14:17 for iOS Knob Control by &#160;<a href="http://www.doxygen.org/index.html">
Generated on Fri May 30 2014 14:41:20 for iOS Knob Control by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.5
</small></address>
Expand Down
2 changes: 1 addition & 1 deletion doc/html/functions.html
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Fri May 30 2014 11:14:17 for iOS Knob Control by &#160;<a href="http://www.doxygen.org/index.html">
Generated on Fri May 30 2014 14:41:20 for iOS Knob Control by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.5
</small></address>
Expand Down
2 changes: 1 addition & 1 deletion doc/html/functions_func.html
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Fri May 30 2014 11:14:17 for iOS Knob Control by &#160;<a href="http://www.doxygen.org/index.html">
Generated on Fri May 30 2014 14:41:20 for iOS Knob Control by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.5
</small></address>
Expand Down
2 changes: 1 addition & 1 deletion doc/html/functions_prop.html
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Fri May 30 2014 11:14:17 for iOS Knob Control by &#160;<a href="http://www.doxygen.org/index.html">
Generated on Fri May 30 2014 14:41:20 for iOS Knob Control by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.5
</small></address>
Expand Down
2 changes: 1 addition & 1 deletion doc/html/hierarchy.html
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Fri May 30 2014 11:14:17 for iOS Knob Control by &#160;<a href="http://www.doxygen.org/index.html">
Generated on Fri May 30 2014 14:41:20 for iOS Knob Control by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.5
</small></address>
Expand Down
2 changes: 1 addition & 1 deletion doc/html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
</div></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Fri May 30 2014 11:14:17 for iOS Knob Control by &#160;<a href="http://www.doxygen.org/index.html">
Generated on Fri May 30 2014 14:41:20 for iOS Knob Control by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.5
</small></address>
Expand Down
5 changes: 2 additions & 3 deletions doc/html/interface_i_o_s_knob_control.html
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,7 @@
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>A simple, reusable rotary control. You may provide custom knob images or use the default images, which may be customized using a number of properties and methods. The control chooses an image based on state, like the UIButton control. In any state but disabled, the knob control responds to a one-fingered rotation gesture and animates rotation of the current image in response, programmatically reading out the current angular position of the knob and generating a UIControlEventValueChanged each time the knob rotates.</p>
<p>The knob control and all images must be square. Images will usually be circles or regular polygons, with a transparent background or a solid one that matches the view behind it. However, the aspect ratio must be 1:1. The effect of the animation is circular rotation. This only works if the control is square. You can produce other effects, for example, by partially clipping a square control or using an oblong background. But the control itself always has to be square.</p>
<p>DEBT: Enforce this. <a href="https://github.com/jdee/ios-knob-control/issues/5">https://github.com/jdee/ios-knob-control/issues/5</a></p>
<p>The knob control and all images must be square. Images will usually be circles or regular polygons, with a transparent background or a solid one that matches the view behind it. However, the aspect ratio must be 1:1. The effect of the animation is circular rotation. This only works if the control is square. You can produce other effects, for example, by partially clipping a square control or using an oblong background. But the control itself always has to be square. If an oblong frame is specified for the control, the frame will be made square. The larger of the original sides will will be used for both the width and height. The origin of the frame will be unchanged.</p>
<p>The knob control requires ARC, and hence iOS 5.0 or later. It has not been tested below iOS 6.1. </p>
</div><h2 class="groupheader">Method Documentation</h2>
<a class="anchor" id="a88ce867ee0371b151ed7a59622db8ef3"></a>
Expand Down Expand Up @@ -837,7 +836,7 @@ <h2 class="groupheader">Property Documentation</h2>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Fri May 30 2014 11:14:17 for iOS Knob Control by &#160;<a href="http://www.doxygen.org/index.html">
Generated on Fri May 30 2014 14:41:20 for iOS Knob Control by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.5
</small></address>
Expand Down

0 comments on commit fa56dc9

Please sign in to comment.